Chromium Code Reviews| 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_EXAMPLES_TABLE_EXAMPLE_H_ | 5 #ifndef UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_ |
| 6 #define UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_ | 6 #define UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 #include "ui/base/models/table_model.h" | 13 #include "ui/base/models/table_model.h" |
| 14 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
| 15 #include "ui/views/controls/table/table_grouper.h" | |
| 15 #include "ui/views/controls/table/table_view.h" | 16 #include "ui/views/controls/table/table_view.h" |
| 16 #include "ui/views/controls/table/table_view_observer.h" | 17 #include "ui/views/controls/table/table_view_observer.h" |
| 17 #include "ui/views/examples/example_base.h" | 18 #include "ui/views/examples/example_base.h" |
| 18 | 19 |
| 19 namespace gfx { | 20 namespace gfx { |
| 20 class ImageSkia; | 21 class ImageSkia; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace views { | 24 namespace views { |
| 24 class Checkbox; | 25 class Checkbox; |
| 25 class Event; | 26 class Event; |
| 26 class TableView; | 27 class TableView; |
| 27 | 28 |
| 28 namespace examples { | 29 namespace examples { |
| 29 | 30 |
| 30 class TableExample : public ExampleBase, | 31 class TableExample |
| 31 public ui::TableModel, | 32 : public ExampleBase, |
| 32 public TableViewObserver, | 33 public ui::TableModel, |
| 33 public ButtonListener { | 34 public views::TableGrouper, |
|
tfarina
2013/01/08 23:01:24
nit: you shouldn't need views:: here, as TableExam
| |
| 35 public TableViewObserver, | |
| 36 public ButtonListener { | |
| 34 public: | 37 public: |
| 35 TableExample(); | 38 TableExample(); |
| 36 virtual ~TableExample(); | 39 virtual ~TableExample(); |
| 37 | 40 |
| 38 // ExampleBase: | 41 // ExampleBase: |
| 39 virtual void CreateExampleView(View* container) OVERRIDE; | 42 virtual void CreateExampleView(View* container) OVERRIDE; |
| 40 | 43 |
| 41 // ui::TableModel: | 44 // ui::TableModel: |
| 42 virtual int RowCount() OVERRIDE; | 45 virtual int RowCount() OVERRIDE; |
| 43 virtual string16 GetText(int row, int column_id) OVERRIDE; | 46 virtual string16 GetText(int row, int column_id) OVERRIDE; |
| 44 virtual gfx::ImageSkia GetIcon(int row) OVERRIDE; | 47 virtual gfx::ImageSkia GetIcon(int row) OVERRIDE; |
| 45 virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; | 48 virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; |
| 46 | 49 |
| 50 // views::TableGrouper: | |
| 51 virtual void GetGroupRange(int model_index, GroupRange* range) OVERRIDE; | |
| 52 | |
| 47 // TableViewObserver: | 53 // TableViewObserver: |
| 48 virtual void OnSelectionChanged() OVERRIDE; | 54 virtual void OnSelectionChanged() OVERRIDE; |
| 49 virtual void OnDoubleClick() OVERRIDE; | 55 virtual void OnDoubleClick() OVERRIDE; |
| 50 virtual void OnMiddleClick() OVERRIDE; | 56 virtual void OnMiddleClick() OVERRIDE; |
| 51 virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) OVERRIDE; | 57 virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) OVERRIDE; |
| 52 | 58 |
| 53 // ButtonListener: | 59 // ButtonListener: |
| 54 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; | 60 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; |
| 55 | 61 |
| 56 private: | 62 private: |
| 57 // The table to be tested. | 63 // The table to be tested. |
| 58 TableView* table_; | 64 TableView* table_; |
| 59 | 65 |
| 60 Checkbox* column1_visible_checkbox_; | 66 Checkbox* column1_visible_checkbox_; |
| 61 Checkbox* column2_visible_checkbox_; | 67 Checkbox* column2_visible_checkbox_; |
| 62 Checkbox* column3_visible_checkbox_; | 68 Checkbox* column3_visible_checkbox_; |
| 63 Checkbox* column4_visible_checkbox_; | 69 Checkbox* column4_visible_checkbox_; |
| 64 | 70 |
| 65 SkBitmap icon1_; | 71 SkBitmap icon1_; |
| 66 SkBitmap icon2_; | 72 SkBitmap icon2_; |
| 67 | 73 |
| 68 DISALLOW_COPY_AND_ASSIGN(TableExample); | 74 DISALLOW_COPY_AND_ASSIGN(TableExample); |
| 69 }; | 75 }; |
| 70 | 76 |
| 71 } // namespace examples | 77 } // namespace examples |
| 72 } // namespace views | 78 } // namespace views |
| 73 | 79 |
| 74 #endif // UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_ | 80 #endif // UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_ |
| OLD | NEW |