| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // platforms support icons in menus natively and so this is a hint for | 42 // platforms support icons in menus natively and so this is a hint for |
| 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. | 48 // within. It is guaranteed to be reset to a clean default state. |
| 49 // IMPORTANT: If the model implementation returns something _other_ than 0 | 49 // IMPORTANT: If the model implementation returns something _other_ than 0 |
| 50 // here, it must offset the values for |index| it passes to the | 50 // here, it must offset the values for |index| it passes to the |
| 51 // methods below by this number - this is NOT done automatically! | 51 // methods below by this number - this is NOT done automatically! |
| 52 virtual int GetFirstItemIndex(gfx::NativeMenu native_menu) const { return 0; } | 52 virtual int GetFirstItemIndex(gfx::NativeMenu native_menu) const; |
| 53 | 53 |
| 54 // Returns the number of items in the menu. | 54 // Returns the number of items in the menu. |
| 55 virtual int GetItemCount() const = 0; | 55 virtual int GetItemCount() const = 0; |
| 56 | 56 |
| 57 // Returns the type of item at the specified index. | 57 // Returns the type of item at the specified index. |
| 58 virtual ItemType GetTypeAt(int index) const = 0; | 58 virtual ItemType GetTypeAt(int index) const = 0; |
| 59 | 59 |
| 60 // Returns the command id of the item at the specified index. | 60 // Returns the command id of the item at the specified index. |
| 61 virtual int GetCommandIdAt(int index) const = 0; | 61 virtual int GetCommandIdAt(int index) const = 0; |
| 62 | 62 |
| 63 // Returns the label of the item at the specified index. | 63 // Returns the label of the item at the specified index. |
| 64 virtual string16 GetLabelAt(int index) const = 0; | 64 virtual string16 GetLabelAt(int index) const = 0; |
| 65 | 65 |
| 66 // Returns true if the label at the specified index can change over the course | 66 // Returns true if the label at the specified index can change over the course |
| 67 // of the menu's lifetime. If this function returns true, the label of the | 67 // of the menu's lifetime. If this function returns true, the label of the |
| 68 // menu item will be updated each time the menu is shown. | 68 // menu item will be updated each time the menu is shown. |
| 69 virtual bool IsLabelDynamicAt(int index) const = 0; | 69 virtual bool IsLabelDynamicAt(int index) const = 0; |
| 70 | 70 |
| 71 // Returns the font use for the label at the specified index. | 71 // Returns the font use for the label at the specified index. |
| 72 // If NULL, then use default font. | 72 // If NULL, then use default font. |
| 73 virtual const gfx::Font* GetLabelFontAt(int index) const { return NULL; } | 73 virtual const gfx::Font* GetLabelFontAt(int index) const; |
| 74 | 74 |
| 75 // Gets the acclerator information for the specified index, returning true if | 75 // Gets the acclerator information for the specified index, returning true if |
| 76 // there is a shortcut accelerator for the item, false otherwise. | 76 // there is a shortcut accelerator for the item, false otherwise. |
| 77 virtual bool GetAcceleratorAt(int index, | 77 virtual bool GetAcceleratorAt(int index, |
| 78 menus::Accelerator* accelerator) const = 0; | 78 menus::Accelerator* accelerator) const = 0; |
| 79 | 79 |
| 80 // Returns the checked state of the item at the specified index. | 80 // Returns the checked state of the item at the specified index. |
| 81 virtual bool IsItemCheckedAt(int index) const = 0; | 81 virtual bool IsItemCheckedAt(int index) const = 0; |
| 82 | 82 |
| 83 // 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 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // Retrieves the model and index that contains a specific command id. Returns | 117 // Retrieves the model and index that contains a specific command id. Returns |
| 118 // true if an item with the specified command id is found. |model| is inout, | 118 // true if an item with the specified command id is found. |model| is inout, |
| 119 // and specifies the model to start searching from. | 119 // and specifies the model to start searching from. |
| 120 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, | 120 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, |
| 121 int* index); | 121 int* index); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 } // namespace | 124 } // namespace |
| 125 | 125 |
| 126 #endif // APP_MENUS_MENU_MODEL_H_ | 126 #endif // APP_MENUS_MENU_MODEL_H_ |
| OLD | NEW |