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 #ifndef VIEWS_CONTROLS_TABLE_GROUP_TABLE_VIEW_H_ | 5 #ifndef VIEWS_CONTROLS_TABLE_GROUP_TABLE_VIEW_H_ |
6 #define VIEWS_CONTROLS_TABLE_GROUP_TABLE_VIEW_H_ | 6 #define VIEWS_CONTROLS_TABLE_GROUP_TABLE_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/table_model.h" | 9 #include "app/table_model.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // Extra-painting required to draw the separator line between groups. | 50 // Extra-painting required to draw the separator line between groups. |
51 virtual bool ImplementPostPaint() { return true; } | 51 virtual bool ImplementPostPaint() { return true; } |
52 virtual void PostPaint(int model_row, int column, bool selected, | 52 virtual void PostPaint(int model_row, int column, bool selected, |
53 const gfx::Rect& bounds, HDC device_context); | 53 const gfx::Rect& bounds, HDC device_context); |
54 | 54 |
55 // In order to make keyboard navigation possible (using the Up and Down | 55 // In order to make keyboard navigation possible (using the Up and Down |
56 // keys), we must take action when an arrow key is pressed. The reason we | 56 // keys), we must take action when an arrow key is pressed. The reason we |
57 // need to process this message has to do with the manner in which the focus | 57 // need to process this message has to do with the manner in which the focus |
58 // needs to be set on a group item when a group is selected. | 58 // needs to be set on a group item when a group is selected. |
59 virtual bool OnKeyDown(base::KeyboardCode virtual_keycode); | 59 virtual bool OnKeyDown(app::KeyboardCode virtual_keycode); |
60 | 60 |
61 // Overriden to make sure rows in the same group stay grouped together. | 61 // Overriden to make sure rows in the same group stay grouped together. |
62 virtual int CompareRows(int model_row1, int model_row2); | 62 virtual int CompareRows(int model_row1, int model_row2); |
63 | 63 |
64 // Updates model_index_to_range_start_map_ from the model. | 64 // Updates model_index_to_range_start_map_ from the model. |
65 virtual void PrepareForSort(); | 65 virtual void PrepareForSort(); |
66 | 66 |
67 private: | 67 private: |
68 // Make the selection of group consistent. | 68 // Make the selection of group consistent. |
69 void SyncSelection(); | 69 void SyncSelection(); |
70 | 70 |
71 GroupTableModel* model_; | 71 GroupTableModel* model_; |
72 | 72 |
73 // A factory to make the selection consistent among groups. | 73 // A factory to make the selection consistent among groups. |
74 ScopedRunnableMethodFactory<GroupTableView> sync_selection_factory_; | 74 ScopedRunnableMethodFactory<GroupTableView> sync_selection_factory_; |
75 | 75 |
76 // Maps from model row to start of group. | 76 // Maps from model row to start of group. |
77 std::map<int,int> model_index_to_range_start_map_; | 77 std::map<int,int> model_index_to_range_start_map_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(GroupTableView); | 79 DISALLOW_COPY_AND_ASSIGN(GroupTableView); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace views | 82 } // namespace views |
83 | 83 |
84 #endif // VIEWS_CONTROLS_TABLE_GROUP_TABLE_VIEW_H_ | 84 #endif // VIEWS_CONTROLS_TABLE_GROUP_TABLE_VIEW_H_ |
OLD | NEW |