| 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_TABLE_VIEW2_H_ | 5 #ifndef VIEWS_CONTROLS_TABLE_TABLE_VIEW2_H_ |
| 6 #define VIEWS_CONTROLS_TABLE_TABLE_VIEW2_H_ | 6 #define VIEWS_CONTROLS_TABLE_TABLE_VIEW2_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/base/models/table_model_observer.h" | 15 #include "ui/base/models/table_model_observer.h" |
| 15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 16 #include "views/controls/table/native_table_wrapper.h" | 17 #include "views/controls/table/native_table_wrapper.h" |
| 17 #include "views/controls/table/table_view.h" | 18 #include "views/controls/table/table_view.h" |
| 18 #include "views/view.h" | 19 #include "views/view.h" |
| 19 | 20 |
| 20 class SkBitmap; | |
| 21 | |
| 22 namespace ui { | 21 namespace ui { |
| 23 struct TableColumn; | 22 struct TableColumn; |
| 24 class TableModel; | 23 class TableModel; |
| 25 } | 24 } |
| 26 | 25 |
| 27 // A TableView2 is a view that displays multiple rows with any number of | 26 // A TableView2 is a view that displays multiple rows with any number of |
| 28 // columns. | 27 // columns. |
| 29 // TableView is driven by a TableModel. The model returns the contents | 28 // TableView is driven by a TableModel. The model returns the contents |
| 30 // to display. TableModel also has an Observer which is used to notify | 29 // to display. TableModel also has an Observer which is used to notify |
| 31 // TableView of changes to the model so that the display may be updated | 30 // TableView of changes to the model so that the display may be updated |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 190 } |
| 192 | 191 |
| 193 virtual void Layout(); | 192 virtual void Layout(); |
| 194 | 193 |
| 195 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); | 194 virtual void OnPaintFocusBorder(gfx::Canvas* canvas); |
| 196 | 195 |
| 197 // Used by tests. | 196 // Used by tests. |
| 198 virtual gfx::NativeView GetTestingHandle(); | 197 virtual gfx::NativeView GetTestingHandle(); |
| 199 | 198 |
| 200 protected: | 199 protected: |
| 201 virtual NativeTableWrapper* CreateWrapper(); | 200 virtual void ViewHierarchyChanged(bool is_add, |
| 202 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); | 201 View* parent, |
| 202 View* child) OVERRIDE; |
| 203 | 203 |
| 204 private: | 204 private: |
| 205 friend class ListViewParent; | 205 friend class ListViewParent; |
| 206 friend class TableSelectionIterator; | 206 friend class TableSelectionIterator; |
| 207 | 207 |
| 208 // Used in the constructors. | 208 // Used in the constructors. |
| 209 void Init(const std::vector<ui::TableColumn>& columns); | 209 void Init(const std::vector<ui::TableColumn>& columns); |
| 210 | 210 |
| 211 // We need this wrapper to pass the table view to the windows proc handler | 211 // We need this wrapper to pass the table view to the windows proc handler |
| 212 // when subclassing the list view and list view header, as the reinterpret | 212 // when subclassing the list view and list view header, as the reinterpret |
| 213 // cast from GetWindowLongPtr would break the pointer if it is pointing to a | 213 // cast from GetWindowLongPtr would break the pointer if it is pointing to a |
| 214 // subclass (in the OO sense of TableView). | 214 // subclass (in the OO sense of TableView). |
| 215 struct TableViewWrapper { | 215 struct TableViewWrapper { |
| 216 explicit TableViewWrapper(TableView2* view) : table_view(view) { } | 216 explicit TableViewWrapper(TableView2* view) : table_view(view) {} |
| 217 TableView2* table_view; | 217 TableView2* table_view; |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 // Adds a new column. | 220 // Adds a new column. |
| 221 void InsertColumn(const ui::TableColumn& tc, int index); | 221 void InsertColumn(const ui::TableColumn& tc, int index); |
| 222 | 222 |
| 223 // Update headers and internal state after columns have changed | 223 // Update headers and internal state after columns have changed |
| 224 void OnColumnsChanged(); | 224 void OnColumnsChanged(); |
| 225 | 225 |
| 226 ui::TableModel* model_; | 226 ui::TableModel* model_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 // The object that actually implements the table. | 260 // The object that actually implements the table. |
| 261 NativeTableWrapper* native_wrapper_; | 261 NativeTableWrapper* native_wrapper_; |
| 262 | 262 |
| 263 DISALLOW_COPY_AND_ASSIGN(TableView2); | 263 DISALLOW_COPY_AND_ASSIGN(TableView2); |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 } // namespace views | 266 } // namespace views |
| 267 | 267 |
| 268 #endif // VIEWS_CONTROLS_TABLE_TABLE_VIEW2_H_ | 268 #endif // VIEWS_CONTROLS_TABLE_TABLE_VIEW2_H_ |
| OLD | NEW |