| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/views/group_table_view.h" | 5 #include "chrome/views/group_table_view.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "chrome/common/gfx/chrome_canvas.h" | 9 #include "chrome/common/gfx/chrome_canvas.h" |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // this is the item the user happened to click on). If then the UP arrow is | 80 // this is the item the user happened to click on). If then the UP arrow is |
| 81 // pressed once, the focus will be switched to ItemC and not to ItemA and the | 81 // pressed once, the focus will be switched to ItemC and not to ItemA and the |
| 82 // end result is that we are stuck in GroupX even though the intention was to | 82 // end result is that we are stuck in GroupX even though the intention was to |
| 83 // switch to ItemA. | 83 // switch to ItemA. |
| 84 // | 84 // |
| 85 // For that exact reason, we need to set the focus appropriately when we | 85 // For that exact reason, we need to set the focus appropriately when we |
| 86 // detect that one of the arrow keys is pressed. Thus, when it comes time | 86 // detect that one of the arrow keys is pressed. Thus, when it comes time |
| 87 // for the list view control to actually switch the focus, the right item | 87 // for the list view control to actually switch the focus, the right item |
| 88 // will be selected. | 88 // will be selected. |
| 89 if ((virtual_keycode != VK_UP) && (virtual_keycode != VK_DOWN)) { | 89 if ((virtual_keycode != VK_UP) && (virtual_keycode != VK_DOWN)) { |
| 90 TableView::OnKeyDown(virtual_keycode); |
| 90 return; | 91 return; |
| 91 } | 92 } |
| 92 | 93 |
| 93 // We start by finding the index of the item with the focus. If no item | 94 // We start by finding the index of the item with the focus. If no item |
| 94 // currently has the focus, then this routine doesn't do anything. | 95 // currently has the focus, then this routine doesn't do anything. |
| 95 int focused_index; | 96 int focused_index; |
| 96 int row_count = model_->RowCount(); | 97 int row_count = model_->RowCount(); |
| 97 for (focused_index = 0; focused_index < row_count; focused_index++) { | 98 for (focused_index = 0; focused_index < row_count; focused_index++) { |
| 98 if (ItemHasTheFocus(focused_index)) { | 99 if (ItemHasTheFocus(focused_index)) { |
| 99 break; | 100 break; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 160 } |
| 160 SelectObject(hdc, hPenOld); | 161 SelectObject(hdc, hPenOld); |
| 161 DeleteObject(hPen); | 162 DeleteObject(hPen); |
| 162 } | 163 } |
| 163 | 164 |
| 164 std::string GroupTableView::GetClassName() const { | 165 std::string GroupTableView::GetClassName() const { |
| 165 return kViewClassName; | 166 return kViewClassName; |
| 166 } | 167 } |
| 167 } // Namespace | 168 } // Namespace |
| 168 | 169 |
| OLD | NEW |