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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 virtual bool IsItemForCommandIdDynamic(int command_id) const; | 32 virtual bool IsItemForCommandIdDynamic(int command_id) const; |
33 virtual base::string16 GetLabelForCommandId(int command_id) const; | 33 virtual base::string16 GetLabelForCommandId(int command_id) const; |
34 | 34 |
35 // Performs the action associated with the specified command id. | 35 // Performs the action associated with the specified command id. |
36 virtual void ExecuteCommand(int command_id, int event_flags) = 0; | 36 virtual void ExecuteCommand(int command_id, int event_flags) = 0; |
37 virtual bool IsCommandIdEnabled(int command_id) const; | 37 virtual bool IsCommandIdEnabled(int command_id) const; |
38 virtual bool DoesCommandIdDismissMenu(int command_id) const; | 38 virtual bool DoesCommandIdDismissMenu(int command_id) const; |
39 | 39 |
40 // Gets the accelerator for the specified command id. Returns true if the | 40 // Gets the accelerator for the specified command id. Returns true if the |
41 // command id has a valid accelerator, false otherwise. | 41 // command id has a valid accelerator, false otherwise. |
42 virtual bool GetAcceleratorForCommandId(int command_id, | 42 virtual bool GetAcceleratorForCommandId( |
43 ui::Accelerator* accelerator) = 0; | 43 int command_id, |
| 44 ui::Accelerator* accelerator) const = 0; |
44 | 45 |
45 protected: | 46 protected: |
46 virtual ~Delegate() {} | 47 virtual ~Delegate() {} |
47 }; | 48 }; |
48 | 49 |
49 ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate); | 50 ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate); |
50 ~ButtonMenuItemModel(); | 51 ~ButtonMenuItemModel(); |
51 | 52 |
52 // Adds a button that will emit |command_id|. All buttons created through | 53 // Adds a button that will emit |command_id|. All buttons created through |
53 // this method will have the same size, based on the largest button. | 54 // this method will have the same size, based on the largest button. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 std::vector<Item> items_; | 117 std::vector<Item> items_; |
117 | 118 |
118 Delegate* delegate_; | 119 Delegate* delegate_; |
119 | 120 |
120 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); | 121 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); |
121 }; | 122 }; |
122 | 123 |
123 } // namespace ui | 124 } // namespace ui |
124 | 125 |
125 #endif // UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ | 126 #endif // UI_BASE_MODELS_BUTTON_MENU_ITEM_MODEL_H_ |
OLD | NEW |