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 19 matching lines...) Expand all Loading... |
30 }; | 30 }; |
31 | 31 |
32 class GroupTableView : public TableView { | 32 class GroupTableView : public TableView { |
33 public: | 33 public: |
34 // The view class name. | 34 // The view class name. |
35 static const char kViewClassName[]; | 35 static const char kViewClassName[]; |
36 | 36 |
37 GroupTableView(GroupTableModel* model, | 37 GroupTableView(GroupTableModel* model, |
38 const std::vector<TableColumn>& columns, | 38 const std::vector<TableColumn>& columns, |
39 TableTypes table_type, bool single_selection, | 39 TableTypes table_type, bool single_selection, |
40 bool resizable_columns, bool autosize_columns); | 40 bool resizable_columns, bool autosize_columns, |
| 41 bool draw_group_separators); |
41 virtual ~GroupTableView(); | 42 virtual ~GroupTableView(); |
42 | 43 |
43 virtual std::string GetClassName() const; | 44 virtual std::string GetClassName() const; |
44 | 45 |
45 protected: | 46 protected: |
46 // Notification from the ListView that the selected state of an item has | 47 // Notification from the ListView that the selected state of an item has |
47 // changed. | 48 // changed. |
48 void OnSelectedStateChanged(); | 49 void OnSelectedStateChanged(); |
49 | 50 |
50 // Extra-painting required to draw the separator line between groups. | 51 // Extra-painting required to draw the separator line between groups. |
(...skipping 12 matching lines...) Expand all Loading... |
63 | 64 |
64 // Updates model_index_to_range_start_map_ from the model. | 65 // Updates model_index_to_range_start_map_ from the model. |
65 virtual void PrepareForSort(); | 66 virtual void PrepareForSort(); |
66 | 67 |
67 private: | 68 private: |
68 // Make the selection of group consistent. | 69 // Make the selection of group consistent. |
69 void SyncSelection(); | 70 void SyncSelection(); |
70 | 71 |
71 GroupTableModel* model_; | 72 GroupTableModel* model_; |
72 | 73 |
| 74 // If true, draw separators between groups. |
| 75 bool draw_group_separators_; |
| 76 |
73 // A factory to make the selection consistent among groups. | 77 // A factory to make the selection consistent among groups. |
74 ScopedRunnableMethodFactory<GroupTableView> sync_selection_factory_; | 78 ScopedRunnableMethodFactory<GroupTableView> sync_selection_factory_; |
75 | 79 |
76 // Maps from model row to start of group. | 80 // Maps from model row to start of group. |
77 std::map<int,int> model_index_to_range_start_map_; | 81 std::map<int,int> model_index_to_range_start_map_; |
78 | 82 |
79 DISALLOW_COPY_AND_ASSIGN(GroupTableView); | 83 DISALLOW_COPY_AND_ASSIGN(GroupTableView); |
80 }; | 84 }; |
81 | 85 |
82 } // namespace views | 86 } // namespace views |
83 | 87 |
84 #endif // VIEWS_CONTROLS_TABLE_GROUP_TABLE_VIEW_H_ | 88 #endif // VIEWS_CONTROLS_TABLE_GROUP_TABLE_VIEW_H_ |
OLD | NEW |