OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/task.h" | 9 #include "base/task.h" |
10 #include "ui/base/models/table_model.h" | 10 #include "ui/base/models/table_model.h" |
11 #include "views/controls/table/table_view.h" | 11 #include "views/controls/table/table_view.h" |
12 | 12 |
13 // The GroupTableView adds grouping to the TableView class. | 13 // The GroupTableView adds grouping to the TableView class. |
14 // It allows to have groups of rows that act as a single row from the selection | 14 // It allows to have groups of rows that act as a single row from the selection |
15 // perspective. Groups are visually separated by a horizontal line. | 15 // perspective. Groups are visually separated by a horizontal line. |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 | 18 |
19 struct GroupRange { | 19 struct GroupRange { |
20 int start; | 20 int start; |
21 int length; | 21 int length; |
22 }; | 22 }; |
23 | 23 |
24 // The model driving the GroupTableView. | 24 // The model driving the GroupTableView. |
25 class GroupTableModel : public TableModel { | 25 class GroupTableModel : public ui::TableModel { |
26 public: | 26 public: |
27 // Populates the passed range with the first row/last row (included) | 27 // Populates the passed range with the first row/last row (included) |
28 // that this item belongs to. | 28 // that this item belongs to. |
29 virtual void GetGroupRangeForItem(int item, GroupRange* range) = 0; | 29 virtual void GetGroupRangeForItem(int item, GroupRange* range) = 0; |
30 }; | 30 }; |
31 | 31 |
32 class VIEWS_EXPORT GroupTableView : public TableView { | 32 class VIEWS_EXPORT 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<ui::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 bool draw_group_separators); |
42 virtual ~GroupTableView(); | 42 virtual ~GroupTableView(); |
43 | 43 |
44 virtual std::string GetClassName() const; | 44 virtual std::string GetClassName() const; |
45 | 45 |
46 protected: | 46 protected: |
47 // 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 |
48 // changed. | 48 // changed. |
(...skipping 30 matching lines...) Expand all Loading... |
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 |