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_SIMPLE_MENU_MODEL_H_ | 5 #ifndef UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
6 #define UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 6 #define UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Gets the icon for the item with the specified id, returning true if there | 41 // Gets the icon for the item with the specified id, returning true if there |
42 // is an icon, false otherwise. | 42 // is an icon, false otherwise. |
43 virtual bool GetIconForCommandId(int command_id, SkBitmap* icon) const; | 43 virtual bool GetIconForCommandId(int command_id, SkBitmap* icon) const; |
44 | 44 |
45 // Notifies the delegate that the item with the specified command id was | 45 // Notifies the delegate that the item with the specified command id was |
46 // visually highlighted within the menu. | 46 // visually highlighted within the menu. |
47 virtual void CommandIdHighlighted(int command_id); | 47 virtual void CommandIdHighlighted(int command_id); |
48 | 48 |
49 // Performs the action associated with the specified command id. | 49 // Performs the action associated with the specified command id. |
50 virtual void ExecuteCommand(int command_id) = 0; | 50 virtual void ExecuteCommand(int command_id) = 0; |
| 51 virtual void ExecuteCommandWithDisposition(int command_id, int disposition); |
51 | 52 |
52 // Notifies the delegate that the menu has closed. | 53 // Notifies the delegate that the menu has closed. |
53 virtual void MenuClosed(); | 54 virtual void MenuClosed(); |
54 | 55 |
55 protected: | 56 protected: |
56 virtual ~Delegate() {} | 57 virtual ~Delegate() {} |
57 }; | 58 }; |
58 | 59 |
59 // The Delegate can be NULL, though if it is items can't be checked or | 60 // The Delegate can be NULL, though if it is items can't be checked or |
60 // disabled. | 61 // disabled. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 virtual bool GetAcceleratorAt(int index, | 112 virtual bool GetAcceleratorAt(int index, |
112 ui::Accelerator* accelerator) const; | 113 ui::Accelerator* accelerator) const; |
113 virtual bool IsItemCheckedAt(int index) const; | 114 virtual bool IsItemCheckedAt(int index) const; |
114 virtual int GetGroupIdAt(int index) const; | 115 virtual int GetGroupIdAt(int index) const; |
115 virtual bool GetIconAt(int index, SkBitmap* icon); | 116 virtual bool GetIconAt(int index, SkBitmap* icon); |
116 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const; | 117 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const; |
117 virtual bool IsEnabledAt(int index) const; | 118 virtual bool IsEnabledAt(int index) const; |
118 virtual bool IsVisibleAt(int index) const; | 119 virtual bool IsVisibleAt(int index) const; |
119 virtual void HighlightChangedTo(int index); | 120 virtual void HighlightChangedTo(int index); |
120 virtual void ActivatedAt(int index); | 121 virtual void ActivatedAt(int index); |
| 122 virtual void ActivatedAtWithDisposition(int index, int disposition); |
121 virtual MenuModel* GetSubmenuModelAt(int index) const; | 123 virtual MenuModel* GetSubmenuModelAt(int index) const; |
122 virtual void MenuClosed(); | 124 virtual void MenuClosed(); |
123 virtual void SetMenuModelDelegate(ui::MenuModelDelegate* menu_model_delegate); | 125 virtual void SetMenuModelDelegate(ui::MenuModelDelegate* menu_model_delegate); |
124 | 126 |
125 protected: | 127 protected: |
126 // Some variants of this model (SystemMenuModel) relies on items to be | 128 // Some variants of this model (SystemMenuModel) relies on items to be |
127 // inserted backwards. This is counter-intuitive for the API, so rather than | 129 // inserted backwards. This is counter-intuitive for the API, so rather than |
128 // forcing customers to insert things backwards, we return the indices | 130 // forcing customers to insert things backwards, we return the indices |
129 // backwards instead. That's what this method is for. By default, it just | 131 // backwards instead. That's what this method is for. By default, it just |
130 // returns what it's passed. | 132 // returns what it's passed. |
(...skipping 21 matching lines...) Expand all Loading... |
152 MenuModelDelegate* menu_model_delegate_; | 154 MenuModelDelegate* menu_model_delegate_; |
153 | 155 |
154 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; | 156 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; |
155 | 157 |
156 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 158 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
157 }; | 159 }; |
158 | 160 |
159 } // namespace ui | 161 } // namespace ui |
160 | 162 |
161 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 163 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
OLD | NEW |