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_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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void SetMinorText(int index, const base::string16& minor_text); | 133 void SetMinorText(int index, const base::string16& minor_text); |
134 | 134 |
135 // Clears all items. Note that it does not free MenuModel of submenu. | 135 // Clears all items. Note that it does not free MenuModel of submenu. |
136 void Clear(); | 136 void Clear(); |
137 | 137 |
138 // Returns the index of the item that has the given |command_id|. Returns | 138 // Returns the index of the item that has the given |command_id|. Returns |
139 // -1 if not found. | 139 // -1 if not found. |
140 int GetIndexOfCommandId(int command_id); | 140 int GetIndexOfCommandId(int command_id); |
141 | 141 |
142 // Overridden from MenuModel: | 142 // Overridden from MenuModel: |
143 virtual bool HasIcons() const OVERRIDE; | 143 virtual bool HasIcons() const override; |
144 virtual int GetItemCount() const OVERRIDE; | 144 virtual int GetItemCount() const override; |
145 virtual ItemType GetTypeAt(int index) const OVERRIDE; | 145 virtual ItemType GetTypeAt(int index) const override; |
146 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const OVERRIDE; | 146 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; |
147 virtual int GetCommandIdAt(int index) const OVERRIDE; | 147 virtual int GetCommandIdAt(int index) const override; |
148 virtual base::string16 GetLabelAt(int index) const OVERRIDE; | 148 virtual base::string16 GetLabelAt(int index) const override; |
149 virtual base::string16 GetSublabelAt(int index) const OVERRIDE; | 149 virtual base::string16 GetSublabelAt(int index) const override; |
150 virtual base::string16 GetMinorTextAt(int index) const OVERRIDE; | 150 virtual base::string16 GetMinorTextAt(int index) const override; |
151 virtual bool IsItemDynamicAt(int index) const OVERRIDE; | 151 virtual bool IsItemDynamicAt(int index) const override; |
152 virtual bool GetAcceleratorAt(int index, | 152 virtual bool GetAcceleratorAt(int index, |
153 ui::Accelerator* accelerator) const OVERRIDE; | 153 ui::Accelerator* accelerator) const override; |
154 virtual bool IsItemCheckedAt(int index) const OVERRIDE; | 154 virtual bool IsItemCheckedAt(int index) const override; |
155 virtual int GetGroupIdAt(int index) const OVERRIDE; | 155 virtual int GetGroupIdAt(int index) const override; |
156 virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE; | 156 virtual bool GetIconAt(int index, gfx::Image* icon) override; |
157 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( | 157 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( |
158 int index) const OVERRIDE; | 158 int index) const override; |
159 virtual bool IsEnabledAt(int index) const OVERRIDE; | 159 virtual bool IsEnabledAt(int index) const override; |
160 virtual bool IsVisibleAt(int index) const OVERRIDE; | 160 virtual bool IsVisibleAt(int index) const override; |
161 virtual void HighlightChangedTo(int index) OVERRIDE; | 161 virtual void HighlightChangedTo(int index) override; |
162 virtual void ActivatedAt(int index) OVERRIDE; | 162 virtual void ActivatedAt(int index) override; |
163 virtual void ActivatedAt(int index, int event_flags) OVERRIDE; | 163 virtual void ActivatedAt(int index, int event_flags) override; |
164 virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; | 164 virtual MenuModel* GetSubmenuModelAt(int index) const override; |
165 virtual void MenuWillShow() OVERRIDE; | 165 virtual void MenuWillShow() override; |
166 virtual void MenuClosed() OVERRIDE; | 166 virtual void MenuClosed() override; |
167 virtual void SetMenuModelDelegate( | 167 virtual void SetMenuModelDelegate( |
168 ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; | 168 ui::MenuModelDelegate* menu_model_delegate) override; |
169 virtual MenuModelDelegate* GetMenuModelDelegate() const OVERRIDE; | 169 virtual MenuModelDelegate* GetMenuModelDelegate() const override; |
170 | 170 |
171 protected: | 171 protected: |
172 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 172 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
173 Delegate* delegate() { return delegate_; } | 173 Delegate* delegate() { return delegate_; } |
174 | 174 |
175 // One or more of the menu menu items associated with the model has changed. | 175 // One or more of the menu menu items associated with the model has changed. |
176 // Do any handling if necessary. | 176 // Do any handling if necessary. |
177 virtual void MenuItemsChanged(); | 177 virtual void MenuItemsChanged(); |
178 | 178 |
179 private: | 179 private: |
(...skipping 19 matching lines...) Expand all Loading... |
199 MenuModelDelegate* menu_model_delegate_; | 199 MenuModelDelegate* menu_model_delegate_; |
200 | 200 |
201 base::WeakPtrFactory<SimpleMenuModel> method_factory_; | 201 base::WeakPtrFactory<SimpleMenuModel> method_factory_; |
202 | 202 |
203 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 203 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
204 }; | 204 }; |
205 | 205 |
206 } // namespace ui | 206 } // namespace ui |
207 | 207 |
208 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 208 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
OLD | NEW |