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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 virtual bool HasIcons() const; | 105 virtual bool HasIcons() const; |
106 virtual int GetItemCount() const; | 106 virtual int GetItemCount() const; |
107 virtual ItemType GetTypeAt(int index) const; | 107 virtual ItemType GetTypeAt(int index) const; |
108 virtual int GetCommandIdAt(int index) const; | 108 virtual int GetCommandIdAt(int index) const; |
109 virtual string16 GetLabelAt(int index) const; | 109 virtual string16 GetLabelAt(int index) const; |
110 virtual bool IsItemDynamicAt(int index) const; | 110 virtual bool IsItemDynamicAt(int index) const; |
111 virtual bool GetAcceleratorAt(int index, | 111 virtual bool GetAcceleratorAt(int index, |
112 ui::Accelerator* accelerator) const; | 112 ui::Accelerator* accelerator) const; |
113 virtual bool IsItemCheckedAt(int index) const; | 113 virtual bool IsItemCheckedAt(int index) const; |
114 virtual int GetGroupIdAt(int index) const; | 114 virtual int GetGroupIdAt(int index) const; |
115 virtual bool GetIconAt(int index, SkBitmap* icon) const; | 115 virtual bool GetIconAt(int index, SkBitmap* icon); |
116 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const; | 116 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const; |
117 virtual bool IsEnabledAt(int index) const; | 117 virtual bool IsEnabledAt(int index) const; |
118 virtual bool IsVisibleAt(int index) const; | 118 virtual bool IsVisibleAt(int index) const; |
119 virtual void HighlightChangedTo(int index); | 119 virtual void HighlightChangedTo(int index); |
120 virtual void ActivatedAt(int index); | 120 virtual void ActivatedAt(int index); |
121 virtual MenuModel* GetSubmenuModelAt(int index) const; | 121 virtual MenuModel* GetSubmenuModelAt(int index) const; |
122 virtual void MenuClosed(); | 122 virtual void MenuClosed(); |
| 123 virtual void SetDelegate(ui::MenuModel::Delegate* delegate); |
123 | 124 |
124 protected: | 125 protected: |
125 // Some variants of this model (SystemMenuModel) relies on items to be | 126 // Some variants of this model (SystemMenuModel) relies on items to be |
126 // inserted backwards. This is counter-intuitive for the API, so rather than | 127 // inserted backwards. This is counter-intuitive for the API, so rather than |
127 // forcing customers to insert things backwards, we return the indices | 128 // forcing customers to insert things backwards, we return the indices |
128 // backwards instead. That's what this method is for. By default, it just | 129 // backwards instead. That's what this method is for. By default, it just |
129 // returns what it's passed. | 130 // returns what it's passed. |
130 virtual int FlipIndex(int index) const; | 131 virtual int FlipIndex(int index) const; |
131 | 132 |
132 Delegate* delegate() { return delegate_; } | 133 Delegate* delegate() { return delegate_; } |
(...skipping 14 matching lines...) Expand all Loading... |
147 Delegate* delegate_; | 148 Delegate* delegate_; |
148 | 149 |
149 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; | 150 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; |
150 | 151 |
151 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 152 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
152 }; | 153 }; |
153 | 154 |
154 } // namespace ui | 155 } // namespace ui |
155 | 156 |
156 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 157 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
OLD | NEW |