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_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 | 7 |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "ui/base/models/menu_model_delegate.h" | 9 #include "ui/base/models/menu_model_delegate.h" |
10 #include "ui/base/models/menu_separator_types.h" | 10 #include "ui/base/models/menu_separator_types.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // triggering a custom rendering mode. | 43 // triggering a custom rendering mode. |
44 virtual bool HasIcons() const = 0; | 44 virtual bool HasIcons() const = 0; |
45 | 45 |
46 // Returns the index of the first item. This is 0 for most menus except the | 46 // Returns the index of the first item. This is 0 for most menus except the |
47 // system menu on Windows. |native_menu| is the menu to locate the start index | 47 // system menu on Windows. |native_menu| is the menu to locate the start index |
48 // within. It is guaranteed to be reset to a clean default state. Some | 48 // within. It is guaranteed to be reset to a clean default state. Some |
49 // callers of this method may pass NULL for native_menu. | 49 // callers of this method may pass NULL for native_menu. |
50 // IMPORTANT: If the model implementation returns something _other_ than 0 | 50 // IMPORTANT: If the model implementation returns something _other_ than 0 |
51 // here, it must offset the values for |index| it passes to the | 51 // here, it must offset the values for |index| it passes to the |
52 // methods below by this number - this is NOT done automatically! | 52 // methods below by this number - this is NOT done automatically! |
| 53 // TODO(sky): remove this from MenuModel. It's confusing. |
53 virtual int GetFirstItemIndex(gfx::NativeMenu native_menu) const; | 54 virtual int GetFirstItemIndex(gfx::NativeMenu native_menu) const; |
54 | 55 |
55 // Returns the number of items in the menu. | 56 // Returns the number of items in the menu. |
56 virtual int GetItemCount() const = 0; | 57 virtual int GetItemCount() const = 0; |
57 | 58 |
58 // Returns the type of item at the specified index. | 59 // Returns the type of item at the specified index. |
59 virtual ItemType GetTypeAt(int index) const = 0; | 60 virtual ItemType GetTypeAt(int index) const = 0; |
60 | 61 |
61 // Returns the separator type at the specified index. | 62 // Returns the separator type at the specified index. |
62 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const = 0; | 63 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const = 0; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Retrieves the model and index that contains a specific command id. Returns | 133 // Retrieves the model and index that contains a specific command id. Returns |
133 // true if an item with the specified command id is found. |model| is inout, | 134 // true if an item with the specified command id is found. |model| is inout, |
134 // and specifies the model to start searching from. | 135 // and specifies the model to start searching from. |
135 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, | 136 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, |
136 int* index); | 137 int* index); |
137 }; | 138 }; |
138 | 139 |
139 } // namespace ui | 140 } // namespace ui |
140 | 141 |
141 #endif // UI_BASE_MODELS_MENU_MODEL_H_ | 142 #endif // UI_BASE_MODELS_MENU_MODEL_H_ |
OLD | NEW |