diff options
Diffstat (limited to 'views/controls/table/group_table_view.cc')
-rw-r--r-- | views/controls/table/group_table_view.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/views/controls/table/group_table_view.cc b/views/controls/table/group_table_view.cc index 5f26756..a70515d 100644 --- a/views/controls/table/group_table_view.cc +++ b/views/controls/table/group_table_view.cc @@ -61,7 +61,7 @@ void GroupTableView::SyncSelection() { } } -void GroupTableView::OnKeyDown(unsigned short virtual_keycode) { +bool GroupTableView::OnKeyDown(base::KeyboardCode virtual_keycode) { // In a list view, multiple items can be selected but only one item has the // focus. This creates a problem when the arrow keys are used for navigating // between items in the list view. An example will make this more clear: @@ -87,9 +87,9 @@ void GroupTableView::OnKeyDown(unsigned short virtual_keycode) { // detect that one of the arrow keys is pressed. Thus, when it comes time // for the list view control to actually switch the focus, the right item // will be selected. - if ((virtual_keycode != VK_UP) && (virtual_keycode != VK_DOWN)) { - TableView::OnKeyDown(virtual_keycode); - return; + if ((virtual_keycode != base::VKEY_UP) && + (virtual_keycode != base::VKEY_DOWN)) { + return TableView::OnKeyDown(virtual_keycode); } // We start by finding the index of the item with the focus. If no item @@ -102,27 +102,28 @@ void GroupTableView::OnKeyDown(unsigned short virtual_keycode) { } } - if (focused_index == row_count) { - return; - } + if (focused_index == row_count) + return false; + DCHECK_LT(focused_index, row_count); // Nothing to do if the item which has the focus is not part of a group. GroupRange group_range; model_->GetGroupRangeForItem(focused_index, &group_range); - if (group_range.length == 1) { - return; - } + if (group_range.length == 1) + return false; // If the user pressed the UP key, then the focus should be set to the // topmost element in the group. If the user pressed the DOWN key, the focus // should be set to the bottommost element. - if (virtual_keycode == VK_UP) { + if (virtual_keycode == base::VKEY_UP) { SetFocusOnItem(group_range.start); } else { - DCHECK_EQ(virtual_keycode, VK_DOWN); + DCHECK_EQ(virtual_keycode, base::VKEY_DOWN); SetFocusOnItem(group_range.start + group_range.length - 1); } + + return false; } void GroupTableView::PrepareForSort() { |