OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
6 #define VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "ui/base/dragdrop/drag_drop_types.h" | 13 #include "ui/base/dragdrop/drag_drop_types.h" |
14 #include "ui/base/dragdrop/os_exchange_data.h" | 14 #include "ui/base/dragdrop/os_exchange_data.h" |
15 #include "views/controls/menu/menu_item_view.h" | 15 #include "views/controls/menu/menu_item_view.h" |
16 #include "views/events/event.h" | 16 #include "views/events/event.h" |
17 | 17 |
18 using ui::OSExchangeData; | 18 using ui::OSExchangeData; |
19 | 19 |
20 namespace gfx { | |
21 | |
22 class Font; | |
23 | |
24 } // namespace gfx | |
25 | |
20 namespace views { | 26 namespace views { |
21 | 27 |
22 class DropTargetEvent; | 28 class DropTargetEvent; |
23 class MenuButton; | 29 class MenuButton; |
24 | 30 |
25 // MenuDelegate -------------------------------------------------------------- | 31 // MenuDelegate -------------------------------------------------------------- |
26 | 32 |
27 // Delegate for a menu. This class is used as part of MenuItemView, see it | 33 // Delegate for a menu. This class is used as part of MenuItemView, see it |
28 // for details. | 34 // for details. |
29 // TODO(sky): merge this with ui::MenuModel. | 35 // TODO(sky): merge this with ui::MenuModel. |
(...skipping 16 matching lines...) Expand all Loading... | |
46 }; | 52 }; |
47 | 53 |
48 // Whether or not an item should be shown as checked. This is invoked for | 54 // Whether or not an item should be shown as checked. This is invoked for |
49 // radio buttons and check buttons. | 55 // radio buttons and check buttons. |
50 virtual bool IsItemChecked(int id) const; | 56 virtual bool IsItemChecked(int id) const; |
51 | 57 |
52 // The string shown for the menu item. This is only invoked when an item is | 58 // The string shown for the menu item. This is only invoked when an item is |
53 // added with an empty label. | 59 // added with an empty label. |
54 virtual std::wstring GetLabel(int id) const; | 60 virtual std::wstring GetLabel(int id) const; |
55 | 61 |
62 // The font for the menu item label. Returning NULL selects the default | |
63 // menu font. | |
64 virtual const gfx::Font& GetLabelFont(int id) const; | |
sky
2011/04/20 16:02:58
Last sentence isn't right. Maybe just remove it en
rhashimoto
2011/04/21 19:31:17
Done.
| |
65 | |
56 // The tooltip shown for the menu item. This is invoked when the user | 66 // The tooltip shown for the menu item. This is invoked when the user |
57 // hovers over the item, and no tooltip text has been set for that item. | 67 // hovers over the item, and no tooltip text has been set for that item. |
58 virtual std::wstring GetTooltipText(int id, const gfx::Point& screen_loc); | 68 virtual std::wstring GetTooltipText(int id, const gfx::Point& screen_loc); |
59 | 69 |
60 // If there is an accelerator for the menu item with id |id| it is set in | 70 // If there is an accelerator for the menu item with id |id| it is set in |
61 // |accelerator| and true is returned. | 71 // |accelerator| and true is returned. |
62 virtual bool GetAccelerator(int id, Accelerator* accelerator); | 72 virtual bool GetAccelerator(int id, Accelerator* accelerator); |
63 | 73 |
64 // Shows the context menu with the specified id. This is invoked when the | 74 // Shows the context menu with the specified id. This is invoked when the |
65 // user does the appropriate gesture to show a context menu. The id | 75 // user does the appropriate gesture to show a context menu. The id |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 bool* has_mnemonics, | 184 bool* has_mnemonics, |
175 MenuButton** button); | 185 MenuButton** button); |
176 | 186 |
177 // Returns the max width menus can grow to be. | 187 // Returns the max width menus can grow to be. |
178 virtual int GetMaxWidthForMenu(); | 188 virtual int GetMaxWidthForMenu(); |
179 }; | 189 }; |
180 | 190 |
181 } // namespace views | 191 } // namespace views |
182 | 192 |
183 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 193 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
OLD | NEW |