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_TREE_VIEW_EXAMPLE_H_ | 5 #ifndef UI_VIEWS_EXAMPLES_TREE_VIEW_EXAMPLE_H_ |
6 #define UI_VIEWS_EXAMPLES_TREE_VIEW_EXAMPLE_H_ | 6 #define UI_VIEWS_EXAMPLES_TREE_VIEW_EXAMPLE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/base/models/simple_menu_model.h" | 9 #include "ui/base/models/simple_menu_model.h" |
10 #include "ui/base/models/tree_node_model.h" | 10 #include "ui/base/models/tree_node_model.h" |
11 #include "ui/views/context_menu_controller.h" | 11 #include "ui/views/context_menu_controller.h" |
12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/controls/tree/tree_view_controller.h" | 13 #include "ui/views/controls/tree/tree_view_controller.h" |
14 #include "ui/views/examples/example_base.h" | 14 #include "ui/views/examples/example_base.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 | 17 |
| 18 class LabelButton; |
18 class MenuRunner; | 19 class MenuRunner; |
19 class TreeView; | 20 class TreeView; |
20 | 21 |
21 namespace examples { | 22 namespace examples { |
22 | 23 |
23 class VIEWS_EXAMPLES_EXPORT TreeViewExample | 24 class VIEWS_EXAMPLES_EXPORT TreeViewExample |
24 : public ExampleBase, | 25 : public ExampleBase, |
25 public ButtonListener, | 26 public ButtonListener, |
26 public TreeViewController, | 27 public TreeViewController, |
27 public ContextMenuController, | 28 public ContextMenuController, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 bool IsCommandIdChecked(int command_id) const override; | 64 bool IsCommandIdChecked(int command_id) const override; |
64 bool IsCommandIdEnabled(int command_id) const override; | 65 bool IsCommandIdEnabled(int command_id) const override; |
65 bool GetAcceleratorForCommandId(int command_id, | 66 bool GetAcceleratorForCommandId(int command_id, |
66 ui::Accelerator* accelerator) override; | 67 ui::Accelerator* accelerator) override; |
67 void ExecuteCommand(int command_id, int event_flags) override; | 68 void ExecuteCommand(int command_id, int event_flags) override; |
68 | 69 |
69 // The tree view to be tested. | 70 // The tree view to be tested. |
70 TreeView* tree_view_; | 71 TreeView* tree_view_; |
71 | 72 |
72 // Control buttons to modify the model. | 73 // Control buttons to modify the model. |
73 Button* add_; | 74 LabelButton* add_; |
74 Button* remove_; | 75 LabelButton* remove_; |
75 Button* change_title_; | 76 LabelButton* change_title_; |
76 | 77 |
77 typedef ui::TreeNodeWithValue<int> NodeType; | 78 typedef ui::TreeNodeWithValue<int> NodeType; |
78 | 79 |
79 ui::TreeNodeModel<NodeType> model_; | 80 ui::TreeNodeModel<NodeType> model_; |
80 | 81 |
81 std::unique_ptr<MenuRunner> context_menu_runner_; | 82 std::unique_ptr<MenuRunner> context_menu_runner_; |
82 | 83 |
83 DISALLOW_COPY_AND_ASSIGN(TreeViewExample); | 84 DISALLOW_COPY_AND_ASSIGN(TreeViewExample); |
84 }; | 85 }; |
85 | 86 |
86 } // namespace examples | 87 } // namespace examples |
87 } // namespace views | 88 } // namespace views |
88 | 89 |
89 #endif // UI_VIEWS_EXAMPLES_TREE_VIEW_EXAMPLE_H_ | 90 #endif // UI_VIEWS_EXAMPLES_TREE_VIEW_EXAMPLE_H_ |
OLD | NEW |