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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 int index, int command_id, const string16& label, MenuModel* model); | 93 int index, int command_id, const string16& label, MenuModel* model); |
94 void InsertSubMenuWithStringIdAt( | 94 void InsertSubMenuWithStringIdAt( |
95 int index, int command_id, int string_id, MenuModel* model); | 95 int index, int command_id, int string_id, MenuModel* model); |
96 | 96 |
97 // Sets the icon for the item at |index|. | 97 // Sets the icon for the item at |index|. |
98 void SetIcon(int index, const SkBitmap& icon); | 98 void SetIcon(int index, const SkBitmap& icon); |
99 | 99 |
100 // Clears all items. Note that it does not free MenuModel of submenu. | 100 // Clears all items. Note that it does not free MenuModel of submenu. |
101 void Clear(); | 101 void Clear(); |
102 | 102 |
| 103 // Removes the given item. |
| 104 void RemoveItemAt(int index); |
| 105 |
103 // Returns the index of the item that has the given |command_id|. Returns | 106 // Returns the index of the item that has the given |command_id|. Returns |
104 // -1 if not found. | 107 // -1 if not found. |
105 int GetIndexOfCommandId(int command_id); | 108 int GetIndexOfCommandId(int command_id); |
106 | 109 |
107 // Overridden from MenuModel: | 110 // Overridden from MenuModel: |
108 virtual bool HasIcons() const OVERRIDE; | 111 virtual bool HasIcons() const OVERRIDE; |
109 virtual int GetItemCount() const OVERRIDE; | 112 virtual int GetItemCount() const OVERRIDE; |
110 virtual ItemType GetTypeAt(int index) const OVERRIDE; | 113 virtual ItemType GetTypeAt(int index) const OVERRIDE; |
111 virtual int GetCommandIdAt(int index) const OVERRIDE; | 114 virtual int GetCommandIdAt(int index) const OVERRIDE; |
112 virtual string16 GetLabelAt(int index) const OVERRIDE; | 115 virtual string16 GetLabelAt(int index) const OVERRIDE; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |