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. |
| 63 virtual const gfx::Font& GetLabelFont(int id) const; |
| 64 |
56 // The tooltip shown for the menu item. This is invoked when the user | 65 // 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. | 66 // 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); | 67 virtual std::wstring GetTooltipText(int id, const gfx::Point& screen_loc); |
59 | 68 |
60 // If there is an accelerator for the menu item with id |id| it is set in | 69 // If there is an accelerator for the menu item with id |id| it is set in |
61 // |accelerator| and true is returned. | 70 // |accelerator| and true is returned. |
62 virtual bool GetAccelerator(int id, Accelerator* accelerator); | 71 virtual bool GetAccelerator(int id, Accelerator* accelerator); |
63 | 72 |
64 // Shows the context menu with the specified id. This is invoked when the | 73 // 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 | 74 // 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, | 183 bool* has_mnemonics, |
175 MenuButton** button); | 184 MenuButton** button); |
176 | 185 |
177 // Returns the max width menus can grow to be. | 186 // Returns the max width menus can grow to be. |
178 virtual int GetMaxWidthForMenu(); | 187 virtual int GetMaxWidthForMenu(); |
179 }; | 188 }; |
180 | 189 |
181 } // namespace views | 190 } // namespace views |
182 | 191 |
183 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 192 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
OLD | NEW |