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