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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // - a check box and some text | 45 // - a check box and some text |
46 enum TableTypes { | 46 enum TableTypes { |
47 TEXT_ONLY = 0, | 47 TEXT_ONLY = 0, |
48 ICON_AND_TEXT, | 48 ICON_AND_TEXT, |
49 }; | 49 }; |
50 | 50 |
51 class VIEWS_EXPORT TableView | 51 class VIEWS_EXPORT TableView |
52 : public views::View, | 52 : public views::View, |
53 public ui::TableModelObserver { | 53 public ui::TableModelObserver { |
54 public: | 54 public: |
| 55 // Internal class name. |
| 56 static const char kViewClassName[]; |
| 57 |
55 // Used to track a visible column. Useful only for the header. | 58 // Used to track a visible column. Useful only for the header. |
56 struct VIEWS_EXPORT VisibleColumn { | 59 struct VIEWS_EXPORT VisibleColumn { |
57 VisibleColumn(); | 60 VisibleColumn(); |
58 ~VisibleColumn(); | 61 ~VisibleColumn(); |
59 | 62 |
60 // The column. | 63 // The column. |
61 ui::TableColumn column; | 64 ui::TableColumn column; |
62 | 65 |
63 // Starting x-coordinate of the column. | 66 // Starting x-coordinate of the column. |
64 int x; | 67 int x; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Maps from the index in terms of the model to that of the view. | 162 // Maps from the index in terms of the model to that of the view. |
160 int ModelToView(int model_index) const; | 163 int ModelToView(int model_index) const; |
161 | 164 |
162 // Maps from the index in terms of the view to that of the model. | 165 // Maps from the index in terms of the view to that of the model. |
163 int ViewToModel(int view_index) const; | 166 int ViewToModel(int view_index) const; |
164 | 167 |
165 int row_height() const { return row_height_; } | 168 int row_height() const { return row_height_; } |
166 | 169 |
167 // View overrides: | 170 // View overrides: |
168 void Layout() override; | 171 void Layout() override; |
| 172 const char* GetClassName() const override; |
169 gfx::Size GetPreferredSize() const override; | 173 gfx::Size GetPreferredSize() const override; |
170 bool OnKeyPressed(const ui::KeyEvent& event) override; | 174 bool OnKeyPressed(const ui::KeyEvent& event) override; |
171 bool OnMousePressed(const ui::MouseEvent& event) override; | 175 bool OnMousePressed(const ui::MouseEvent& event) override; |
172 void OnGestureEvent(ui::GestureEvent* event) override; | 176 void OnGestureEvent(ui::GestureEvent* event) override; |
173 bool GetTooltipText(const gfx::Point& p, | 177 bool GetTooltipText(const gfx::Point& p, |
174 base::string16* tooltip) const override; | 178 base::string16* tooltip) const override; |
175 bool GetTooltipTextOrigin(const gfx::Point& p, | 179 bool GetTooltipTextOrigin(const gfx::Point& p, |
176 gfx::Point* loc) const override; | 180 gfx::Point* loc) const override; |
177 void GetAccessibleState(ui::AXViewState* state) override; | 181 void GetAccessibleState(ui::AXViewState* state) override; |
178 | 182 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 345 |
342 // True if in SetVisibleColumnWidth(). | 346 // True if in SetVisibleColumnWidth(). |
343 bool in_set_visible_column_width_; | 347 bool in_set_visible_column_width_; |
344 | 348 |
345 DISALLOW_COPY_AND_ASSIGN(TableView); | 349 DISALLOW_COPY_AND_ASSIGN(TableView); |
346 }; | 350 }; |
347 | 351 |
348 } // namespace views | 352 } // namespace views |
349 | 353 |
350 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ | 354 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_VIEW_VIEWS_H_ |
OLD | NEW |