Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: app/menus/menu_model.h

Issue 2800015: GTK: First draft of the unified cut/copy/paste and +/-/Fullscreen menu items. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: estade cleanups Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « app/menus/button_menu_item_model.cc ('k') | app/menus/simple_menu_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "gfx/native_widget_types.h" 10 #include "gfx/native_widget_types.h"
11 11
12 class SkBitmap; 12 class SkBitmap;
13 13
14 namespace gfx { 14 namespace gfx {
15 15
16 class Font; 16 class Font;
17 17
18 } // namespace gfx 18 } // namespace gfx
19 19
20 namespace menus { 20 namespace menus {
21 21
22 class Accelerator; 22 class Accelerator;
23 class ButtonMenuItemModel;
23 24
24 // An interface implemented by an object that provides the content of a menu. 25 // An interface implemented by an object that provides the content of a menu.
25 class MenuModel { 26 class MenuModel {
26 public: 27 public:
27 virtual ~MenuModel() {} 28 virtual ~MenuModel() {}
28 29
29 // The type of item. 30 // The type of item.
30 enum ItemType { 31 enum ItemType {
31 TYPE_COMMAND, 32 TYPE_COMMAND,
32 TYPE_CHECK, 33 TYPE_CHECK,
33 TYPE_RADIO, 34 TYPE_RADIO,
34 TYPE_SEPARATOR, 35 TYPE_SEPARATOR,
36 TYPE_BUTTON_ITEM,
35 TYPE_SUBMENU 37 TYPE_SUBMENU
36 }; 38 };
37 39
38 // Returns true if any of the items within the model have icons. Not all 40 // Returns true if any of the items within the model have icons. Not all
39 // platforms support icons in menus natively and so this is a hint for 41 // platforms support icons in menus natively and so this is a hint for
40 // triggering a custom rendering mode. 42 // triggering a custom rendering mode.
41 virtual bool HasIcons() const = 0; 43 virtual bool HasIcons() const = 0;
42 44
43 // Returns the index of the first item. This is 0 for most menus except the 45 // Returns the index of the first item. This is 0 for most menus except the
44 // system menu on Windows. |native_menu| is the menu to locate the start index 46 // system menu on Windows. |native_menu| is the menu to locate the start index
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 virtual bool IsItemCheckedAt(int index) const = 0; 80 virtual bool IsItemCheckedAt(int index) const = 0;
79 81
80 // Returns the id of the group of radio items that the item at the specified 82 // Returns the id of the group of radio items that the item at the specified
81 // index belongs to. 83 // index belongs to.
82 virtual int GetGroupIdAt(int index) const = 0; 84 virtual int GetGroupIdAt(int index) const = 0;
83 85
84 // Gets the icon for the item at the specified index, returning true if there 86 // Gets the icon for the item at the specified index, returning true if there
85 // is an icon, false otherwise. 87 // is an icon, false otherwise.
86 virtual bool GetIconAt(int index, SkBitmap* icon) const = 0; 88 virtual bool GetIconAt(int index, SkBitmap* icon) const = 0;
87 89
90 // Returns the model for a menu item with a line of buttons at |index|.
91 virtual ButtonMenuItemModel* GetButtonMenuItemAt(int index) const = 0;
92
88 // Returns the enabled state of the item at the specified index. 93 // Returns the enabled state of the item at the specified index.
89 virtual bool IsEnabledAt(int index) const = 0; 94 virtual bool IsEnabledAt(int index) const = 0;
90 95
91 // Returns the model for the submenu at the specified index. 96 // Returns the model for the submenu at the specified index.
92 virtual MenuModel* GetSubmenuModelAt(int index) const = 0; 97 virtual MenuModel* GetSubmenuModelAt(int index) const = 0;
93 98
94 // Called when the highlighted menu item changes to the item at the specified 99 // Called when the highlighted menu item changes to the item at the specified
95 // index. 100 // index.
96 virtual void HighlightChangedTo(int index) = 0; 101 virtual void HighlightChangedTo(int index) = 0;
97 102
98 // Called when the item at the specified index has been activated. 103 // Called when the item at the specified index has been activated.
99 virtual void ActivatedAt(int index) = 0; 104 virtual void ActivatedAt(int index) = 0;
100 105
101 // Called when the menu is about to be shown. 106 // Called when the menu is about to be shown.
102 virtual void MenuWillShow() {} 107 virtual void MenuWillShow() {}
103 108
104 // Retrieves the model and index that contains a specific command id. Returns 109 // Retrieves the model and index that contains a specific command id. Returns
105 // true if an item with the specified command id is found. |model| is inout, 110 // true if an item with the specified command id is found. |model| is inout,
106 // and specifies the model to start searching from. 111 // and specifies the model to start searching from.
107 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model, 112 static bool GetModelAndIndexForCommandId(int command_id, MenuModel** model,
108 int* index); 113 int* index);
109 }; 114 };
110 115
111 } // namespace 116 } // namespace
112 117
113 #endif // APP_MENUS_MENU_MODEL_H_ 118 #endif // APP_MENUS_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « app/menus/button_menu_item_model.cc ('k') | app/menus/simple_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698