| 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 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 #include "ui/base/models/table_model.h" | 14 #include "ui/base/models/table_model.h" |
| 15 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
| 16 #include "ui/views/controls/table/table_view.h" | 16 #include "ui/views/controls/table/table_view.h" |
| 17 #include "ui/views/controls/table/table_view_observer.h" | 17 #include "ui/views/controls/table/table_view_observer.h" |
| 18 #include "ui/views/examples/example_base.h" | 18 #include "ui/views/examples/example_base.h" |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 class Checkbox; | 21 class Checkbox; |
| 22 class Event; | 22 class Event; |
| 23 class TableView; | 23 class TableView; |
| 24 } | |
| 25 | 24 |
| 26 namespace examples { | 25 namespace examples { |
| 27 | 26 |
| 28 class TableExample : public ExampleBase, | 27 class TableExample : public ExampleBase, |
| 29 public ui::TableModel, | 28 public ui::TableModel, |
| 30 public views::TableViewObserver, | 29 public TableViewObserver, |
| 31 public views::ButtonListener { | 30 public ButtonListener { |
| 32 public: | 31 public: |
| 33 explicit TableExample(ExamplesMain* main); | 32 TableExample(); |
| 34 virtual ~TableExample(); | 33 virtual ~TableExample(); |
| 35 | 34 |
| 36 // ExampleBase: | 35 // ExampleBase: |
| 37 virtual void CreateExampleView(views::View* container) OVERRIDE; | 36 virtual void CreateExampleView(View* container) OVERRIDE; |
| 38 | 37 |
| 39 // ui::TableModel: | 38 // ui::TableModel: |
| 40 virtual int RowCount() OVERRIDE; | 39 virtual int RowCount() OVERRIDE; |
| 41 virtual string16 GetText(int row, int column_id) OVERRIDE; | 40 virtual string16 GetText(int row, int column_id) OVERRIDE; |
| 42 virtual SkBitmap GetIcon(int row) OVERRIDE; | 41 virtual SkBitmap GetIcon(int row) OVERRIDE; |
| 43 virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; | 42 virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; |
| 44 | 43 |
| 45 // views::TableViewObserver: | 44 // TableViewObserver: |
| 46 virtual void OnSelectionChanged() OVERRIDE; | 45 virtual void OnSelectionChanged() OVERRIDE; |
| 47 virtual void OnDoubleClick() OVERRIDE; | 46 virtual void OnDoubleClick() OVERRIDE; |
| 48 virtual void OnMiddleClick() OVERRIDE; | 47 virtual void OnMiddleClick() OVERRIDE; |
| 49 virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) OVERRIDE; | 48 virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) OVERRIDE; |
| 50 virtual void OnTableViewDelete(views::TableView* table_view) OVERRIDE; | 49 virtual void OnTableViewDelete(TableView* table_view) OVERRIDE; |
| 51 virtual void OnTableView2Delete(views::TableView2* table_view) OVERRIDE; | 50 virtual void OnTableView2Delete(TableView2* table_view) OVERRIDE; |
| 52 | 51 |
| 53 // views::ButtonListener: | 52 // ButtonListener: |
| 54 virtual void ButtonPressed(views::Button* sender, | 53 virtual void ButtonPressed(Button* sender, const Event& event) OVERRIDE; |
| 55 const views::Event& event) OVERRIDE; | |
| 56 | 54 |
| 57 private: | 55 private: |
| 58 // The table to be tested. | 56 // The table to be tested. |
| 59 views::TableView* table_; | 57 TableView* table_; |
| 60 | 58 |
| 61 views::Checkbox* column1_visible_checkbox_; | 59 Checkbox* column1_visible_checkbox_; |
| 62 views::Checkbox* column2_visible_checkbox_; | 60 Checkbox* column2_visible_checkbox_; |
| 63 views::Checkbox* column3_visible_checkbox_; | 61 Checkbox* column3_visible_checkbox_; |
| 64 views::Checkbox* column4_visible_checkbox_; | 62 Checkbox* column4_visible_checkbox_; |
| 65 | 63 |
| 66 SkBitmap icon1_; | 64 SkBitmap icon1_; |
| 67 SkBitmap icon2_; | 65 SkBitmap icon2_; |
| 68 | 66 |
| 69 DISALLOW_COPY_AND_ASSIGN(TableExample); | 67 DISALLOW_COPY_AND_ASSIGN(TableExample); |
| 70 }; | 68 }; |
| 71 | 69 |
| 72 } // namespace examples | 70 } // namespace examples |
| 71 } // namespace views |
| 73 | 72 |
| 74 #endif // UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_ | 73 #endif // UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_ |
| OLD | NEW |