Chromium Code Reviews| 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, | |
| 52 int disposition); | |
| 51 | 53 |
| 52 // Notifies the delegate that the menu is about to show. | 54 // Notifies the delegate that the menu is about to show. |
| 53 virtual void MenuWillShow(); | 55 virtual void MenuWillShow(); |
| 54 | 56 |
| 55 // Notifies the delegate that the menu has closed. | 57 // Notifies the delegate that the menu has closed. |
| 56 virtual void MenuClosed(); | 58 virtual void MenuClosed(); |
| 57 | 59 |
| 58 protected: | 60 protected: |
| 59 virtual ~Delegate() {} | 61 virtual ~Delegate() {} |
| 60 }; | 62 }; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 ui::Accelerator* accelerator) const OVERRIDE; | 117 ui::Accelerator* accelerator) const OVERRIDE; |
| 116 virtual bool IsItemCheckedAt(int index) const OVERRIDE; | 118 virtual bool IsItemCheckedAt(int index) const OVERRIDE; |
| 117 virtual int GetGroupIdAt(int index) const OVERRIDE; | 119 virtual int GetGroupIdAt(int index) const OVERRIDE; |
| 118 virtual bool GetIconAt(int index, SkBitmap* icon) OVERRIDE; | 120 virtual bool GetIconAt(int index, SkBitmap* icon) OVERRIDE; |
| 119 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( | 121 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( |
| 120 int index) const OVERRIDE; | 122 int index) const OVERRIDE; |
| 121 virtual bool IsEnabledAt(int index) const OVERRIDE; | 123 virtual bool IsEnabledAt(int index) const OVERRIDE; |
| 122 virtual bool IsVisibleAt(int index) const OVERRIDE; | 124 virtual bool IsVisibleAt(int index) const OVERRIDE; |
| 123 virtual void HighlightChangedTo(int index) OVERRIDE; | 125 virtual void HighlightChangedTo(int index) OVERRIDE; |
| 124 virtual void ActivatedAt(int index) OVERRIDE; | 126 virtual void ActivatedAt(int index) OVERRIDE; |
| 127 virtual void ActivatedAtWithDisposition(int index, int disposition) OVERRIDE; | |
|
brettw
2011/05/03 19:43:53
I don't understand your changes to this file. How
| |
| 125 virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; | 128 virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; |
| 126 virtual void MenuWillShow() OVERRIDE; | 129 virtual void MenuWillShow() OVERRIDE; |
| 127 virtual void MenuClosed() OVERRIDE; | 130 virtual void MenuClosed() OVERRIDE; |
| 128 virtual void SetMenuModelDelegate( | 131 virtual void SetMenuModelDelegate( |
| 129 ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; | 132 ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; |
| 130 | 133 |
| 131 protected: | 134 protected: |
| 132 // Some variants of this model (SystemMenuModel) relies on items to be | 135 // Some variants of this model (SystemMenuModel) relies on items to be |
| 133 // inserted backwards. This is counter-intuitive for the API, so rather than | 136 // inserted backwards. This is counter-intuitive for the API, so rather than |
| 134 // forcing customers to insert things backwards, we return the indices | 137 // forcing customers to insert things backwards, we return the indices |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 158 MenuModelDelegate* menu_model_delegate_; | 161 MenuModelDelegate* menu_model_delegate_; |
| 159 | 162 |
| 160 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; | 163 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; |
| 161 | 164 |
| 162 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 165 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
| 163 }; | 166 }; |
| 164 | 167 |
| 165 } // namespace ui | 168 } // namespace ui |
| 166 | 169 |
| 167 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 170 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
| OLD | NEW |