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 "base/string16.h" | 13 #include "base/string16.h" |
14 #include "ui/base/dragdrop/drag_drop_types.h" | 14 #include "ui/base/dragdrop/drag_drop_types.h" |
15 #include "ui/base/dragdrop/os_exchange_data.h" | 15 #include "ui/base/dragdrop/os_exchange_data.h" |
16 #include "views/controls/menu/menu_item_view.h" | 16 #include "views/controls/menu/menu_item_view.h" |
17 #include "views/events/event.h" | 17 #include "views/events/event.h" |
18 | 18 |
19 using ui::OSExchangeData; | 19 using ui::OSExchangeData; |
20 | 20 |
21 namespace gfx { | 21 namespace gfx { |
22 | 22 |
23 class Font; | 23 class Font; |
24 | 24 |
25 } // namespace gfx | 25 } // namespace gfx |
26 | 26 |
| 27 namespace ui { |
| 28 |
| 29 class Accelerator; |
| 30 |
| 31 } // namespace ui |
| 32 |
27 namespace views { | 33 namespace views { |
28 | 34 |
29 class DropTargetEvent; | 35 class DropTargetEvent; |
30 class MenuButton; | 36 class MenuButton; |
31 | 37 |
32 // MenuDelegate -------------------------------------------------------------- | 38 // MenuDelegate -------------------------------------------------------------- |
33 | 39 |
34 // Delegate for a menu. This class is used as part of MenuItemView, see it | 40 // Delegate for a menu. This class is used as part of MenuItemView, see it |
35 // for details. | 41 // for details. |
36 // TODO(sky): merge this with ui::MenuModel. | 42 // TODO(sky): merge this with ui::MenuModel. |
(...skipping 29 matching lines...) Expand all Loading... |
66 | 72 |
67 // The font for the menu item label. | 73 // The font for the menu item label. |
68 virtual const gfx::Font& GetLabelFont(int id) const; | 74 virtual const gfx::Font& GetLabelFont(int id) const; |
69 | 75 |
70 // The tooltip shown for the menu item. This is invoked when the user | 76 // The tooltip shown for the menu item. This is invoked when the user |
71 // hovers over the item, and no tooltip text has been set for that item. | 77 // hovers over the item, and no tooltip text has been set for that item. |
72 virtual string16 GetTooltipText(int id, const gfx::Point& screen_loc) const; | 78 virtual string16 GetTooltipText(int id, const gfx::Point& screen_loc) const; |
73 | 79 |
74 // If there is an accelerator for the menu item with id |id| it is set in | 80 // If there is an accelerator for the menu item with id |id| it is set in |
75 // |accelerator| and true is returned. | 81 // |accelerator| and true is returned. |
76 virtual bool GetAccelerator(int id, Accelerator* accelerator); | 82 virtual bool GetAccelerator(int id, ui::Accelerator* accelerator); |
77 | 83 |
78 // Shows the context menu with the specified id. This is invoked when the | 84 // Shows the context menu with the specified id. This is invoked when the |
79 // user does the appropriate gesture to show a context menu. The id | 85 // user does the appropriate gesture to show a context menu. The id |
80 // identifies the id of the menu to show the context menu for. | 86 // identifies the id of the menu to show the context menu for. |
81 // is_mouse_gesture is true if this is the result of a mouse gesture. | 87 // is_mouse_gesture is true if this is the result of a mouse gesture. |
82 // If this is not the result of a mouse gesture |p| is the recommended | 88 // If this is not the result of a mouse gesture |p| is the recommended |
83 // location to display the content menu at. In either case, |p| is in | 89 // location to display the content menu at. In either case, |p| is in |
84 // screen coordinates. | 90 // screen coordinates. |
85 // Returns true if a context menu was displayed, otherwise false | 91 // Returns true if a context menu was displayed, otherwise false |
86 virtual bool ShowContextMenu(MenuItemView* source, | 92 virtual bool ShowContextMenu(MenuItemView* source, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // Invoked prior to a menu being shown. | 200 // Invoked prior to a menu being shown. |
195 virtual void WillShowMenu(MenuItemView* menu); | 201 virtual void WillShowMenu(MenuItemView* menu); |
196 | 202 |
197 // Invoked prior to a menu being hidden. | 203 // Invoked prior to a menu being hidden. |
198 virtual void WillHideMenu(MenuItemView* menu); | 204 virtual void WillHideMenu(MenuItemView* menu); |
199 }; | 205 }; |
200 | 206 |
201 } // namespace views | 207 } // namespace views |
202 | 208 |
203 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 209 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
OLD | NEW |