OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" |
13 #include "ui/base/dragdrop/drag_drop_types.h" | 14 #include "ui/base/dragdrop/drag_drop_types.h" |
14 #include "ui/base/dragdrop/os_exchange_data.h" | 15 #include "ui/base/dragdrop/os_exchange_data.h" |
15 #include "ui/views/controls/menu/menu_item_view.h" | 16 #include "ui/base/ui_base_types.h" |
| 17 #include "ui/views/controls/menu/menu_types.h" |
| 18 #include "ui/views/views_export.h" |
16 | 19 |
17 using ui::OSExchangeData; | 20 using ui::OSExchangeData; |
18 | 21 |
19 namespace gfx { | 22 namespace gfx { |
20 class FontList; | 23 class FontList; |
| 24 class Point; |
21 } | 25 } |
22 | 26 |
23 namespace ui { | 27 namespace ui { |
24 class Accelerator; | 28 class Accelerator; |
| 29 class DropTargetEvent; |
25 } | 30 } |
26 | 31 |
27 namespace views { | 32 namespace views { |
28 | 33 |
29 class MenuButton; | 34 class MenuButton; |
| 35 class MenuItemView; |
30 | 36 |
31 // MenuDelegate -------------------------------------------------------------- | 37 // MenuDelegate -------------------------------------------------------------- |
32 | 38 |
33 // Delegate for a menu. This class is used as part of MenuItemView, see it | 39 // Delegate for a menu. This class is used as part of MenuItemView, see it |
34 // for details. | 40 // for details. |
35 // TODO(sky): merge this with ui::MenuModel. | 41 // TODO(sky): merge this with ui::MenuModel. |
36 class VIEWS_EXPORT MenuDelegate { | 42 class VIEWS_EXPORT MenuDelegate { |
37 public: | 43 public: |
38 // Used during drag and drop to indicate where the drop indicator should | 44 // Used during drag and drop to indicate where the drop indicator should |
39 // be rendered. | 45 // be rendered. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 virtual void SelectionChanged(MenuItemView* menu) { | 212 virtual void SelectionChanged(MenuItemView* menu) { |
207 } | 213 } |
208 | 214 |
209 // If the user drags the mouse outside the bounds of the menu the delegate | 215 // If the user drags the mouse outside the bounds of the menu the delegate |
210 // is queried for a sibling menu to show. If this returns non-null the | 216 // is queried for a sibling menu to show. If this returns non-null the |
211 // current menu is hidden, and the menu returned from this method is shown. | 217 // current menu is hidden, and the menu returned from this method is shown. |
212 // | 218 // |
213 // The delegate owns the returned menu, not the controller. | 219 // The delegate owns the returned menu, not the controller. |
214 virtual MenuItemView* GetSiblingMenu(MenuItemView* menu, | 220 virtual MenuItemView* GetSiblingMenu(MenuItemView* menu, |
215 const gfx::Point& screen_point, | 221 const gfx::Point& screen_point, |
216 MenuItemView::AnchorPosition* anchor, | 222 MenuAnchorPosition* anchor, |
217 bool* has_mnemonics, | 223 bool* has_mnemonics, |
218 MenuButton** button); | 224 MenuButton** button); |
219 | 225 |
220 // Returns the max width menus can grow to be. | 226 // Returns the max width menus can grow to be. |
221 virtual int GetMaxWidthForMenu(MenuItemView* menu); | 227 virtual int GetMaxWidthForMenu(MenuItemView* menu); |
222 | 228 |
223 // Invoked prior to a menu being shown. | 229 // Invoked prior to a menu being shown. |
224 virtual void WillShowMenu(MenuItemView* menu); | 230 virtual void WillShowMenu(MenuItemView* menu); |
225 | 231 |
226 // Invoked prior to a menu being hidden. | 232 // Invoked prior to a menu being hidden. |
227 virtual void WillHideMenu(MenuItemView* menu); | 233 virtual void WillHideMenu(MenuItemView* menu); |
228 | 234 |
229 // Returns additional horizontal spacing for the icon of the given item. | 235 // Returns additional horizontal spacing for the icon of the given item. |
230 // The |command_id| specifies the item of interest, the |icon_size| tells the | 236 // The |command_id| specifies the item of interest, the |icon_size| tells the |
231 // function the size of the icon and it will then return |left_margin| | 237 // function the size of the icon and it will then return |left_margin| |
232 // and |right_margin| accordingly. Note: Negative values can be returned. | 238 // and |right_margin| accordingly. Note: Negative values can be returned. |
233 virtual void GetHorizontalIconMargins(int command_id, | 239 virtual void GetHorizontalIconMargins(int command_id, |
234 int icon_size, | 240 int icon_size, |
235 int* left_margin, | 241 int* left_margin, |
236 int* right_margin) const; | 242 int* right_margin) const; |
237 // Returns true if the labels should reserve additional spacing for e.g. | 243 // Returns true if the labels should reserve additional spacing for e.g. |
238 // submenu indicators at the end of the line. | 244 // submenu indicators at the end of the line. |
239 virtual bool ShouldReserveSpaceForSubmenuIndicator() const; | 245 virtual bool ShouldReserveSpaceForSubmenuIndicator() const; |
240 }; | 246 }; |
241 | 247 |
242 } // namespace views | 248 } // namespace views |
243 | 249 |
244 #endif // UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 250 #endif // UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
OLD | NEW |