OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ |
6 #define UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ | 6 #define UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "ui/base/models/list_selection_model.h" | 12 #include "ui/base/models/list_selection_model.h" |
13 #include "ui/base/models/table_model.h" | 13 #include "ui/base/models/table_model.h" |
14 #include "ui/base/models/table_model_observer.h" | 14 #include "ui/base/models/table_model_observer.h" |
15 #include "ui/gfx/font_list.h" | 15 #include "ui/gfx/font_list.h" |
16 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
17 #include "ui/views/views_export.h" | 17 #include "ui/views/views_export.h" |
18 | 18 |
19 // A TableView is a view that displays multiple rows with any number of columns. | 19 // A TableView is a view that displays multiple rows with any number of columns. |
20 // TableView is driven by a TableModel. The model returns the contents | 20 // TableView is driven by a TableModel. The model returns the contents |
21 // to display. TableModel also has an Observer which is used to notify | 21 // to display. TableModel also has an Observer which is used to notify |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // If |model| is NULL, the table view cannot be used after this call. This | 100 // If |model| is NULL, the table view cannot be used after this call. This |
101 // should be called in the containing view's destructor to avoid destruction | 101 // should be called in the containing view's destructor to avoid destruction |
102 // issues when the model needs to be deleted before the table. | 102 // issues when the model needs to be deleted before the table. |
103 void SetModel(ui::TableModel* model); | 103 void SetModel(ui::TableModel* model); |
104 ui::TableModel* model() const { return model_; } | 104 ui::TableModel* model() const { return model_; } |
105 | 105 |
106 // Returns a new ScrollView that contains the receiver. | 106 // Returns a new ScrollView that contains the receiver. |
107 View* CreateParentIfNecessary(); | 107 View* CreateParentIfNecessary(); |
108 | 108 |
109 void SetRowBackgroundPainter( | 109 void SetRowBackgroundPainter( |
110 scoped_ptr<TableViewRowBackgroundPainter> painter); | 110 std::unique_ptr<TableViewRowBackgroundPainter> painter); |
111 | 111 |
112 // Sets the TableGrouper. TableView does not own |grouper| (common use case is | 112 // Sets the TableGrouper. TableView does not own |grouper| (common use case is |
113 // to have TableModel implement TableGrouper). | 113 // to have TableModel implement TableGrouper). |
114 void SetGrouper(TableGrouper* grouper); | 114 void SetGrouper(TableGrouper* grouper); |
115 | 115 |
116 // Returns the number of rows in the TableView. | 116 // Returns the number of rows in the TableView. |
117 int RowCount() const; | 117 int RowCount() const; |
118 | 118 |
119 // Returns the number of selected rows. | 119 // Returns the number of selected rows. |
120 // TODO(sky): remove this and force callers to use selection_model(). | 120 // TODO(sky): remove this and force callers to use selection_model(). |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 // The width we layout to. This may differ from |last_parent_width_|. | 344 // The width we layout to. This may differ from |last_parent_width_|. |
345 int layout_width_; | 345 int layout_width_; |
346 | 346 |
347 // Current sort. | 347 // Current sort. |
348 SortDescriptors sort_descriptors_; | 348 SortDescriptors sort_descriptors_; |
349 | 349 |
350 // Mappings used when sorted. | 350 // Mappings used when sorted. |
351 std::vector<int> view_to_model_; | 351 std::vector<int> view_to_model_; |
352 std::vector<int> model_to_view_; | 352 std::vector<int> model_to_view_; |
353 | 353 |
354 scoped_ptr<TableViewRowBackgroundPainter> row_background_painter_; | 354 std::unique_ptr<TableViewRowBackgroundPainter> row_background_painter_; |
355 | 355 |
356 TableGrouper* grouper_; | 356 TableGrouper* grouper_; |
357 | 357 |
358 // True if in SetVisibleColumnWidth(). | 358 // True if in SetVisibleColumnWidth(). |
359 bool in_set_visible_column_width_; | 359 bool in_set_visible_column_width_; |
360 | 360 |
361 DISALLOW_COPY_AND_ASSIGN(TableView); | 361 DISALLOW_COPY_AND_ASSIGN(TableView); |
362 }; | 362 }; |
363 | 363 |
364 } // namespace views | 364 } // namespace views |
365 | 365 |
366 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ | 366 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ |
OLD | NEW |