Fix build break I introduced in previous commit. Add some extra behavior for OutlineListView's right arrow: if the item has children and is expanded, right arrow now jumps to the first child.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30150 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2009-04-13 22:20:49 +00:00
parent 86656c6b30
commit dd0e375f41
2 changed files with 10 additions and 5 deletions

View File

@ -327,7 +327,7 @@ BListView::MouseDown(BPoint point)
if (timeDelta < doubleClickSpeed if (timeDelta < doubleClickSpeed
&& fabs(delta.x) < kDoubleClickTresh && fabs(delta.x) < kDoubleClickTresh
&& fabs(delta.y) < kDoubleClickTresh && fabs(delta.y) < kDoubleClickTresh
&& fTrack->last_index == index) && fTrack->item_index == index)
doubleClick = true; doubleClick = true;
if (doubleClick && index >= fFirstSelected && index <= fLastSelected) { if (doubleClick && index >= fFirstSelected && index <= fLastSelected) {

View File

@ -141,18 +141,23 @@ void
BOutlineListView::KeyDown(const char* bytes, int32 numBytes) BOutlineListView::KeyDown(const char* bytes, int32 numBytes)
{ {
if (numBytes == 1) { if (numBytes == 1) {
int32 currentSel = CurrentSelection();
switch (bytes[0]) { switch (bytes[0]) {
case B_RIGHT_ARROW: case B_RIGHT_ARROW:
{ {
BListItem *item = ItemAt(CurrentSelection()); BListItem *item = ItemAt(currentSel);
if (item && item->fHasSubitems) if (item && item->fHasSubitems) {
if (!IsExpanded(currentSel))
Expand(item); Expand(item);
else
Select(currentSel + 1);
}
return; return;
} }
case B_LEFT_ARROW: case B_LEFT_ARROW:
{ {
BListItem *item = ItemAt(CurrentSelection()); BListItem *item = ItemAt(currentSel);
if (item) { if (item) {
if (item->fHasSubitems) if (item->fHasSubitems)
Collapse(item); Collapse(item);