BOutlineListView: fix keyboard navigation
* On left arrow key select parent item when selected item is collapsed. * Scroll to selected item when expanding/collapsing. Change-Id: Ia404abb970376d4168efd8bba4d8817712a885a6 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2873 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
a9f415f06a
commit
c47cb94a5e
|
@ -199,8 +199,10 @@ BOutlineListView::KeyDown(const char* bytes, int32 numBytes)
|
||||||
if (item && item->fHasSubitems) {
|
if (item && item->fHasSubitems) {
|
||||||
if (!item->IsExpanded())
|
if (!item->IsExpanded())
|
||||||
Expand(item);
|
Expand(item);
|
||||||
else
|
else {
|
||||||
Select(currentSel + 1);
|
Select(currentSel + 1);
|
||||||
|
ScrollToSelection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -209,12 +211,14 @@ BOutlineListView::KeyDown(const char* bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
BListItem* item = ItemAt(currentSel);
|
BListItem* item = ItemAt(currentSel);
|
||||||
if (item) {
|
if (item) {
|
||||||
if (item->fHasSubitems)
|
if (item->fHasSubitems && item->IsExpanded())
|
||||||
Collapse(item);
|
Collapse(item);
|
||||||
else {
|
else {
|
||||||
item = Superitem(item);
|
item = Superitem(item);
|
||||||
if (item)
|
if (item) {
|
||||||
Select(IndexOf(item));
|
Select(IndexOf(item));
|
||||||
|
ScrollToSelection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue