| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // Returns the separator type at the specified index. | 52 // Returns the separator type at the specified index. |
| 53 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const = 0; | 53 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const = 0; |
| 54 | 54 |
| 55 // Returns the command id of the item at the specified index. | 55 // Returns the command id of the item at the specified index. |
| 56 virtual int GetCommandIdAt(int index) const = 0; | 56 virtual int GetCommandIdAt(int index) const = 0; |
| 57 | 57 |
| 58 // Returns the label of the item at the specified index. | 58 // Returns the label of the item at the specified index. |
| 59 virtual string16 GetLabelAt(int index) const = 0; | 59 virtual string16 GetLabelAt(int index) const = 0; |
| 60 | 60 |
| 61 // Returns true if the menu item (label/icon) at the specified index can | 61 // Returns the sublabel of the item at the specified index. The sublabel |
| 62 // change over the course of the menu's lifetime. If this function returns | 62 // is rendered beneath the label and using the font GetSublabelFontAt(). |
| 63 // true, the label and icon of the menu item will be updated each time the | 63 virtual string16 GetSublabelAt(int index) const; |
| 64 // menu is shown. | 64 |
| 65 // Returns true if the menu item (label/sublabel/icon) at the specified |
| 66 // index can change over the course of the menu's lifetime. If this function |
| 67 // returns true, the label, sublabel and icon of the menu item will be |
| 68 // updated each time the menu is shown. |
| 65 virtual bool IsItemDynamicAt(int index) const = 0; | 69 virtual bool IsItemDynamicAt(int index) const = 0; |
| 66 | 70 |
| 67 // Returns the font use for the label at the specified index. | 71 // Returns the font used for the label at the specified index. |
| 68 // If NULL, then use default font. | 72 // If NULL, then the default font should be used. |
| 69 virtual const gfx::Font* GetLabelFontAt(int index) const; | 73 virtual const gfx::Font* GetLabelFontAt(int index) const; |
| 70 | 74 |
| 75 // Returns the font used for the sublabel at the specified index. |
| 76 // If NULL, then the default font should be used. |
| 77 virtual const gfx::Font* GetSublabelFontAt(int index) const; |
| 78 |
| 71 // Gets the acclerator information for the specified index, returning true if | 79 // Gets the acclerator information for the specified index, returning true if |
| 72 // there is a shortcut accelerator for the item, false otherwise. | 80 // there is a shortcut accelerator for the item, false otherwise. |
| 73 virtual bool GetAcceleratorAt(int index, | 81 virtual bool GetAcceleratorAt(int index, |
| 74 ui::Accelerator* accelerator) const = 0; | 82 ui::Accelerator* accelerator) const = 0; |
| 75 | 83 |
| 76 // Returns the checked state of the item at the specified index. | 84 // Returns the checked state of the item at the specified index. |
| 77 virtual bool IsItemCheckedAt(int index) const = 0; | 85 virtual bool IsItemCheckedAt(int index) const = 0; |
| 78 | 86 |
| 79 // Returns the id of the group of radio items that the item at the specified | 87 // Returns the id of the group of radio items that the item at the specified |
| 80 // index belongs to. | 88 // index belongs to. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // true if an item with the specified command id is found. |model| is inout, | 132 // true if an item with the specified command id is found. |model| is inout, |
| 125 // and specifies the model to start searching from. | 133 // and specifies the model to start searching from. |
| 126 static bool GetModelAndIndexForCommandId(int command_id, | 134 static bool GetModelAndIndexForCommandId(int command_id, |
| 127 MenuModel** model, | 135 MenuModel** model, |
| 128 int* index); | 136 int* index); |
| 129 }; | 137 }; |
| 130 | 138 |
| 131 } // namespace ui | 139 } // namespace ui |
| 132 | 140 |
| 133 #endif // UI_BASE_MODELS_MENU_MODEL_H_ | 141 #endif // UI_BASE_MODELS_MENU_MODEL_H_ |
| OLD | NEW |