BCLV: Adjust arrow key behavior.

- Left/right arrow can now be used to collapse/expand the focus
  row. Holding shift reverts to the previous behavior of scrolling
  the view.
This commit is contained in:
Rene Gollent
2014-11-23 09:57:18 -05:00
parent 6136e4303c
commit 8b27b73055
+12
View File
@@ -1656,6 +1656,7 @@ BColumnListView::KeyDown(const char* bytes, int32 numBytes)
case B_RIGHT_ARROW: case B_RIGHT_ARROW:
case B_LEFT_ARROW: case B_LEFT_ARROW:
{ {
if ((modifiers() & B_SHIFT_KEY) != 0) {
float minVal, maxVal; float minVal, maxVal;
fHorizontalScrollBar->GetRange(&minVal, &maxVal); fHorizontalScrollBar->GetRange(&minVal, &maxVal);
float smallStep, largeStep; float smallStep, largeStep;
@@ -1674,6 +1675,17 @@ BColumnListView::KeyDown(const char* bytes, int32 numBytes)
newVal = maxVal; newVal = maxVal;
fHorizontalScrollBar->SetValue(newVal); fHorizontalScrollBar->SetValue(newVal);
} else {
BRow* focusRow = fOutlineView->FocusRow();
if (focusRow == NULL)
break;
bool expanded = focusRow->IsExpanded();
if ((c == B_RIGHT_ARROW && !expanded)
|| (c == B_LEFT_ARROW && expanded)) {
fOutlineView->ToggleFocusRowOpen();
}
}
break; break;
} }