Two more changes to BListView:
* fixed handling of B_HOME and B_END in extend mode for multiselection, such that now all the items inbetween the anchor and the final target are selected, too * made sure that the anchor always gets adjusted in _Select(), as otherwise navigation via cursor keys could get "locked". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31980 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -423,7 +423,7 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||
Select(0);
|
||||
} else {
|
||||
if (fAnchorIndex > 0) {
|
||||
if (fAnchorIndex <= fFirstSelected)
|
||||
if (!extend || fAnchorIndex <= fFirstSelected)
|
||||
Select(fAnchorIndex - 1, extend);
|
||||
else
|
||||
Deselect(fAnchorIndex);
|
||||
@@ -440,7 +440,7 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||
Select(0);
|
||||
} else {
|
||||
if (fAnchorIndex < CountItems() - 1) {
|
||||
if (fAnchorIndex >= fLastSelected)
|
||||
if (!extend || fAnchorIndex >= fLastSelected)
|
||||
Select(fAnchorIndex + 1, extend);
|
||||
else
|
||||
Deselect(fAnchorIndex);
|
||||
@@ -452,11 +452,17 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||
}
|
||||
|
||||
case B_HOME:
|
||||
Select(0, extend);
|
||||
if (extend)
|
||||
Select(0, fAnchorIndex, true);
|
||||
else
|
||||
Select(0, false);
|
||||
ScrollToSelection();
|
||||
break;
|
||||
case B_END:
|
||||
Select(CountItems() - 1, extend);
|
||||
if (extend)
|
||||
Select(fAnchorIndex, CountItems() - 1, true);
|
||||
else
|
||||
Select(CountItems() - 1, false);
|
||||
ScrollToSelection();
|
||||
break;
|
||||
|
||||
@@ -1418,8 +1424,11 @@ BListView::_Select(int32 index, bool extend)
|
||||
|
||||
bool changed = false;
|
||||
|
||||
if (fFirstSelected != -1 && !extend)
|
||||
changed = _DeselectAll(index, index);
|
||||
if (!extend) {
|
||||
fAnchorIndex = index;
|
||||
if (fFirstSelected != -1)
|
||||
changed = _DeselectAll(index, index);
|
||||
}
|
||||
|
||||
BListItem* item = ItemAt(index);
|
||||
if (!item->IsEnabled() || item->IsSelected()) {
|
||||
@@ -1439,9 +1448,6 @@ BListView::_Select(int32 index, bool extend)
|
||||
fLastSelected = index;
|
||||
}
|
||||
|
||||
if (!extend)
|
||||
fAnchorIndex = index;
|
||||
|
||||
ItemAt(index)->Select();
|
||||
if (Window())
|
||||
InvalidateItem(index);
|
||||
|
||||
Reference in New Issue
Block a user