| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 11 #include "ui/base/models/list_selection_model.h" | 12 #include "ui/base/models/list_selection_model.h" |
| 12 #include "ui/base/models/table_model.h" | 13 #include "ui/base/models/table_model.h" |
| 13 #include "ui/base/models/table_model_observer.h" | 14 #include "ui/base/models/table_model_observer.h" |
| 14 #include "ui/gfx/font_list.h" | 15 #include "ui/gfx/font_list.h" |
| 15 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
| 16 #include "ui/views/views_export.h" | 17 #include "ui/views/views_export.h" |
| 17 | 18 |
| 18 // 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. |
| 19 // TableView is driven by a TableModel. The model returns the contents | 20 // TableView is driven by a TableModel. The model returns the contents |
| 20 // 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // 1. | 290 // 1. |
| 290 GroupRange GetGroupRange(int model_index) const; | 291 GroupRange GetGroupRange(int model_index) const; |
| 291 | 292 |
| 292 // Used by both GetTooltipText methods. Returns true if there is a tooltip and | 293 // Used by both GetTooltipText methods. Returns true if there is a tooltip and |
| 293 // sets |tooltip| and/or |tooltip_origin| as appropriate, each of which may be | 294 // sets |tooltip| and/or |tooltip_origin| as appropriate, each of which may be |
| 294 // NULL. | 295 // NULL. |
| 295 bool GetTooltipImpl(const gfx::Point& location, | 296 bool GetTooltipImpl(const gfx::Point& location, |
| 296 base::string16* tooltip, | 297 base::string16* tooltip, |
| 297 gfx::Point* tooltip_origin) const; | 298 gfx::Point* tooltip_origin) const; |
| 298 | 299 |
| 300 // Selects the first row if the table has focus and no row is currently |
| 301 // selected. This is a delayed task posted by OnFocus because things that |
| 302 // request focus are also likely to select a row or rows. |
| 303 void SelectFirstRowIfNoneSelected(); |
| 304 |
| 299 ui::TableModel* model_; | 305 ui::TableModel* model_; |
| 300 | 306 |
| 301 std::vector<ui::TableColumn> columns_; | 307 std::vector<ui::TableColumn> columns_; |
| 302 | 308 |
| 303 // The set of visible columns. The values of these point to |columns_|. This | 309 // The set of visible columns. The values of these point to |columns_|. This |
| 304 // may contain a subset of |columns_|. | 310 // may contain a subset of |columns_|. |
| 305 std::vector<VisibleColumn> visible_columns_; | 311 std::vector<VisibleColumn> visible_columns_; |
| 306 | 312 |
| 307 // The header. This is only created if more than one column is specified or | 313 // The header. This is only created if more than one column is specified or |
| 308 // the first column has a non-empty title. | 314 // the first column has a non-empty title. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 346 |
| 341 // Mappings used when sorted. | 347 // Mappings used when sorted. |
| 342 std::vector<int> view_to_model_; | 348 std::vector<int> view_to_model_; |
| 343 std::vector<int> model_to_view_; | 349 std::vector<int> model_to_view_; |
| 344 | 350 |
| 345 TableGrouper* grouper_; | 351 TableGrouper* grouper_; |
| 346 | 352 |
| 347 // True if in SetVisibleColumnWidth(). | 353 // True if in SetVisibleColumnWidth(). |
| 348 bool in_set_visible_column_width_; | 354 bool in_set_visible_column_width_; |
| 349 | 355 |
| 356 base::WeakPtrFactory<TableView> weak_factory_; |
| 357 |
| 350 DISALLOW_COPY_AND_ASSIGN(TableView); | 358 DISALLOW_COPY_AND_ASSIGN(TableView); |
| 351 }; | 359 }; |
| 352 | 360 |
| 353 } // namespace views | 361 } // namespace views |
| 354 | 362 |
| 355 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ | 363 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ |
| OLD | NEW |