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_MENU_MODEL_H_ | 5 #ifndef UI_BASE_MODELS_MENU_MODEL_H_ |
6 #define UI_BASE_MODELS_MENU_MODEL_H_ | 6 #define UI_BASE_MODELS_MENU_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "ui/base/models/menu_model_delegate.h" |
11 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
12 | 13 |
13 class SkBitmap; | 14 class SkBitmap; |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 class Font; | 17 class Font; |
17 } | 18 } |
18 | 19 |
19 namespace ui { | 20 namespace ui { |
20 | 21 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 79 |
79 // Returns the checked state of the item at the specified index. | 80 // Returns the checked state of the item at the specified index. |
80 virtual bool IsItemCheckedAt(int index) const = 0; | 81 virtual bool IsItemCheckedAt(int index) const = 0; |
81 | 82 |
82 // Returns the id of the group of radio items that the item at the specified | 83 // Returns the id of the group of radio items that the item at the specified |
83 // index belongs to. | 84 // index belongs to. |
84 virtual int GetGroupIdAt(int index) const = 0; | 85 virtual int GetGroupIdAt(int index) const = 0; |
85 | 86 |
86 // Gets the icon for the item at the specified index, returning true if there | 87 // Gets the icon for the item at the specified index, returning true if there |
87 // is an icon, false otherwise. | 88 // is an icon, false otherwise. |
88 virtual bool GetIconAt(int index, SkBitmap* icon) const = 0; | 89 virtual bool GetIconAt(int index, SkBitmap* icon) = 0; |
89 | 90 |
90 // Returns the model for a menu item with a line of buttons at |index|. | 91 // Returns the model for a menu item with a line of buttons at |index|. |
91 virtual ButtonMenuItemModel* GetButtonMenuItemAt(int index) const = 0; | 92 virtual ButtonMenuItemModel* GetButtonMenuItemAt(int index) const = 0; |
92 | 93 |
93 // Returns the enabled state of the item at the specified index. | 94 // Returns the enabled state of the item at the specified index. |
94 virtual bool IsEnabledAt(int index) const = 0; | 95 virtual bool IsEnabledAt(int index) const = 0; |
95 | 96 |
96 // Returns true if the menu item is visible. | 97 // Returns true if the menu item is visible. |
97 virtual bool IsVisibleAt(int index) const; | 98 virtual bool IsVisibleAt(int index) const; |
98 | 99 |
(...skipping 10 matching lines...) Expand all Loading... |
109 // Called when the item has been activated with a given disposition (for the | 110 // Called when the item has been activated with a given disposition (for the |
110 // case where the activation involves a navigation). | 111 // case where the activation involves a navigation). |
111 virtual void ActivatedAtWithDisposition(int index, int disposition); | 112 virtual void ActivatedAtWithDisposition(int index, int disposition); |
112 | 113 |
113 // Called when the menu is about to be shown. | 114 // Called when the menu is about to be shown. |
114 virtual void MenuWillShow() {} | 115 virtual void MenuWillShow() {} |
115 | 116 |
116 // Called when the menu has been closed. | 117 // Called when the menu has been closed. |
117 virtual void MenuClosed() {} | 118 virtual void MenuClosed() {} |
118 | 119 |
| 120 // Set the MenuModelDelegate. Owned by the caller of this function. |
| 121 virtual void SetMenuModelDelegate(MenuModelDelegate* delegate) = 0; |
| 122 |
119 // Retrieves the model and index that contains a specific command id. Returns | 123 // Retrieves the model and index that contains a specific command id. Returns |
120 // true if an item with the specified command id is found. |model| is inout, | 124 // true if an item with the specified command id is found. |model| is inout, |
121 // and specifies the model to start searching from. | 125 // and specifies the model to start searching from. |
122 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, | 126 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, |
123 int* index); | 127 int* index); |
124 }; | 128 }; |
125 | 129 |
126 } // namespace ui | 130 } // namespace ui |
127 | 131 |
128 #endif // UI_BASE_MODELS_MENU_MODEL_H_ | 132 #endif // UI_BASE_MODELS_MENU_MODEL_H_ |
OLD | NEW |