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