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_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ | 5 #ifndef UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ |
6 #define UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ | 6 #define UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "ui/ui_api.h" |
12 | 13 |
13 namespace ui { | 14 namespace ui { |
14 | 15 |
15 // A model representing the rows of buttons that should be inserted in a button | 16 // A model representing the rows of buttons that should be inserted in a button |
16 // containing menu item. | 17 // containing menu item. |
17 class ButtonMenuItemModel { | 18 class UI_API ButtonMenuItemModel { |
18 public: | 19 public: |
19 // Types of buttons. | 20 // Types of buttons. |
20 enum ButtonType { | 21 enum ButtonType { |
21 TYPE_SPACE, | 22 TYPE_SPACE, |
22 TYPE_BUTTON, | 23 TYPE_BUTTON, |
23 TYPE_BUTTON_LABEL | 24 TYPE_BUTTON_LABEL |
24 }; | 25 }; |
25 | 26 |
26 class Delegate { | 27 class UI_API Delegate { |
27 public: | 28 public: |
28 // Some command ids have labels that change over time. | 29 // Some command ids have labels that change over time. |
29 virtual bool IsItemForCommandIdDynamic(int command_id) const; | 30 virtual bool IsItemForCommandIdDynamic(int command_id) const; |
30 virtual string16 GetLabelForCommandId(int command_id) const; | 31 virtual string16 GetLabelForCommandId(int command_id) const; |
31 | 32 |
32 // Performs the action associated with the specified command id. | 33 // Performs the action associated with the specified command id. |
33 virtual void ExecuteCommand(int command_id) = 0; | 34 virtual void ExecuteCommand(int command_id) = 0; |
34 virtual bool IsCommandIdEnabled(int command_id) const; | 35 virtual bool IsCommandIdEnabled(int command_id) const; |
35 virtual bool DoesCommandIdDismissMenu(int command_id) const; | 36 virtual bool DoesCommandIdDismissMenu(int command_id) const; |
36 | 37 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 std::vector<Item> items_; | 105 std::vector<Item> items_; |
105 | 106 |
106 Delegate* delegate_; | 107 Delegate* delegate_; |
107 | 108 |
108 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); | 109 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); |
109 }; | 110 }; |
110 | 111 |
111 } // namespace ui | 112 } // namespace ui |
112 | 113 |
113 #endif // UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ | 114 #endif // UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ |
OLD | NEW |