OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 APP_MENUS_MENU_MODEL_H_ | 5 #ifndef APP_MENUS_MENU_MODEL_H_ |
6 #define APP_MENUS_MENU_MODEL_H_ | 6 #define APP_MENUS_MENU_MODEL_H_ |
7 | 7 |
8 #include "app/gfx/native_widget_types.h" | 8 #include "app/gfx/native_widget_types.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 | 11 |
12 class SkBitmap; | 12 class SkBitmap; |
13 | 13 |
| 14 namespace gfx { |
| 15 |
| 16 class Font; |
| 17 |
| 18 } // namespace gfx |
| 19 |
14 namespace menus { | 20 namespace menus { |
15 | 21 |
16 class Accelerator; | 22 class Accelerator; |
17 | 23 |
18 // An interface implemented by an object that provides the content of a menu. | 24 // An interface implemented by an object that provides the content of a menu. |
19 class MenuModel { | 25 class MenuModel { |
20 public: | 26 public: |
21 virtual ~MenuModel() {} | 27 virtual ~MenuModel() {} |
22 | 28 |
23 // The type of item. | 29 // The type of item. |
(...skipping 28 matching lines...) Expand all Loading... |
52 virtual int GetCommandIdAt(int index) const = 0; | 58 virtual int GetCommandIdAt(int index) const = 0; |
53 | 59 |
54 // Returns the label of the item at the specified index. | 60 // Returns the label of the item at the specified index. |
55 virtual string16 GetLabelAt(int index) const = 0; | 61 virtual string16 GetLabelAt(int index) const = 0; |
56 | 62 |
57 // Returns true if the label at the specified index can change over the course | 63 // Returns true if the label at the specified index can change over the course |
58 // of the menu's lifetime. If this function returns true, the label of the | 64 // of the menu's lifetime. If this function returns true, the label of the |
59 // menu item will be updated each time the menu is shown. | 65 // menu item will be updated each time the menu is shown. |
60 virtual bool IsLabelDynamicAt(int index) const = 0; | 66 virtual bool IsLabelDynamicAt(int index) const = 0; |
61 | 67 |
| 68 // Returns the font use for the label at the specified index. |
| 69 // If NULL, then use default font. |
| 70 virtual const gfx::Font* GetLabelFontAt(int index) const { return NULL; } |
| 71 |
62 // Gets the acclerator information for the specified index, returning true if | 72 // Gets the acclerator information for the specified index, returning true if |
63 // there is a shortcut accelerator for the item, false otherwise. | 73 // there is a shortcut accelerator for the item, false otherwise. |
64 virtual bool GetAcceleratorAt(int index, | 74 virtual bool GetAcceleratorAt(int index, |
65 menus::Accelerator* accelerator) const = 0; | 75 menus::Accelerator* accelerator) const = 0; |
66 | 76 |
67 // Returns the checked state of the item at the specified index. | 77 // Returns the checked state of the item at the specified index. |
68 virtual bool IsItemCheckedAt(int index) const = 0; | 78 virtual bool IsItemCheckedAt(int index) const = 0; |
69 | 79 |
70 // Returns the id of the group of radio items that the item at the specified | 80 // Returns the id of the group of radio items that the item at the specified |
71 // index belongs to. | 81 // index belongs to. |
(...skipping 22 matching lines...) Expand all Loading... |
94 // Retrieves the model and index that contains a specific command id. Returns | 104 // Retrieves the model and index that contains a specific command id. Returns |
95 // true if an item with the specified command id is found. |model| is inout, | 105 // true if an item with the specified command id is found. |model| is inout, |
96 // and specifies the model to start searching from. | 106 // and specifies the model to start searching from. |
97 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, | 107 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, |
98 int* index); | 108 int* index); |
99 }; | 109 }; |
100 | 110 |
101 } // namespace | 111 } // namespace |
102 | 112 |
103 #endif // APP_MENUS_MENU_MODEL_H_ | 113 #endif // APP_MENUS_MENU_MODEL_H_ |
OLD | NEW |