| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 typedef std::vector<SortDescriptor> SortDescriptors; | 84 typedef std::vector<SortDescriptor> SortDescriptors; |
| 85 | 85 |
| 86 // Creates a new table using the model and columns specified. | 86 // Creates a new table using the model and columns specified. |
| 87 // The table type applies to the content of the first column (text, icon and | 87 // The table type applies to the content of the first column (text, icon and |
| 88 // text, checkbox and text). | 88 // text, checkbox and text). |
| 89 TableView(ui::TableModel* model, | 89 TableView(ui::TableModel* model, |
| 90 const std::vector<ui::TableColumn>& columns, | 90 const std::vector<ui::TableColumn>& columns, |
| 91 TableTypes table_type, | 91 TableTypes table_type, |
| 92 bool single_selection); | 92 bool single_selection); |
| 93 virtual ~TableView(); | 93 ~TableView() override; |
| 94 | 94 |
| 95 // Assigns a new model to the table view, detaching the old one if present. | 95 // Assigns a new model to the table view, detaching the old one if present. |
| 96 // If |model| is NULL, the table view cannot be used after this call. This | 96 // If |model| is NULL, the table view cannot be used after this call. This |
| 97 // should be called in the containing view's destructor to avoid destruction | 97 // should be called in the containing view's destructor to avoid destruction |
| 98 // issues when the model needs to be deleted before the table. | 98 // issues when the model needs to be deleted before the table. |
| 99 void SetModel(ui::TableModel* model); | 99 void SetModel(ui::TableModel* model); |
| 100 ui::TableModel* model() const { return model_; } | 100 ui::TableModel* model() const { return model_; } |
| 101 | 101 |
| 102 // Returns a new ScrollView that contains the receiver. | 102 // Returns a new ScrollView that contains the receiver. |
| 103 View* CreateParentIfNecessary(); | 103 View* CreateParentIfNecessary(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 // Maps from the index in terms of the model to that of the view. | 159 // Maps from the index in terms of the model to that of the view. |
| 160 int ModelToView(int model_index) const; | 160 int ModelToView(int model_index) const; |
| 161 | 161 |
| 162 // Maps from the index in terms of the view to that of the model. | 162 // Maps from the index in terms of the view to that of the model. |
| 163 int ViewToModel(int view_index) const; | 163 int ViewToModel(int view_index) const; |
| 164 | 164 |
| 165 int row_height() const { return row_height_; } | 165 int row_height() const { return row_height_; } |
| 166 | 166 |
| 167 // View overrides: | 167 // View overrides: |
| 168 virtual void Layout() override; | 168 void Layout() override; |
| 169 virtual gfx::Size GetPreferredSize() const override; | 169 gfx::Size GetPreferredSize() const override; |
| 170 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 170 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 171 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 171 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 172 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 172 void OnGestureEvent(ui::GestureEvent* event) override; |
| 173 virtual bool GetTooltipText(const gfx::Point& p, | 173 bool GetTooltipText(const gfx::Point& p, |
| 174 base::string16* tooltip) const override; | 174 base::string16* tooltip) const override; |
| 175 virtual bool GetTooltipTextOrigin(const gfx::Point& p, | 175 bool GetTooltipTextOrigin(const gfx::Point& p, |
| 176 gfx::Point* loc) const override; | 176 gfx::Point* loc) const override; |
| 177 | 177 |
| 178 // ui::TableModelObserver overrides: | 178 // ui::TableModelObserver overrides: |
| 179 virtual void OnModelChanged() override; | 179 void OnModelChanged() override; |
| 180 virtual void OnItemsChanged(int start, int length) override; | 180 void OnItemsChanged(int start, int length) override; |
| 181 virtual void OnItemsAdded(int start, int length) override; | 181 void OnItemsAdded(int start, int length) override; |
| 182 virtual void OnItemsRemoved(int start, int length) override; | 182 void OnItemsRemoved(int start, int length) override; |
| 183 | 183 |
| 184 protected: | 184 protected: |
| 185 // View overrides: | 185 // View overrides: |
| 186 virtual gfx::Point GetKeyboardContextMenuLocation() override; | 186 gfx::Point GetKeyboardContextMenuLocation() override; |
| 187 virtual void OnPaint(gfx::Canvas* canvas) override; | 187 void OnPaint(gfx::Canvas* canvas) override; |
| 188 virtual void OnFocus() override; | 188 void OnFocus() override; |
| 189 virtual void OnBlur() override; | 189 void OnBlur() override; |
| 190 | 190 |
| 191 private: | 191 private: |
| 192 friend class TableViewTestHelper; | 192 friend class TableViewTestHelper; |
| 193 struct GroupSortHelper; | 193 struct GroupSortHelper; |
| 194 struct SortHelper; | 194 struct SortHelper; |
| 195 | 195 |
| 196 // Used during painting to determine the range of cells that need to be | 196 // Used during painting to determine the range of cells that need to be |
| 197 // painted. | 197 // painted. |
| 198 // NOTE: the row indices returned by this are in terms of the view and column | 198 // NOTE: the row indices returned by this are in terms of the view and column |
| 199 // indices in terms of |visible_columns_|. | 199 // indices in terms of |visible_columns_|. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 // True if in SetVisibleColumnWidth(). | 341 // True if in SetVisibleColumnWidth(). |
| 342 bool in_set_visible_column_width_; | 342 bool in_set_visible_column_width_; |
| 343 | 343 |
| 344 DISALLOW_COPY_AND_ASSIGN(TableView); | 344 DISALLOW_COPY_AND_ASSIGN(TableView); |
| 345 }; | 345 }; |
| 346 | 346 |
| 347 } // namespace views | 347 } // namespace views |
| 348 | 348 |
| 349 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ | 349 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ |
| OLD | NEW |