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

Side by Side Diff: ui/views/controls/menu/menu_delegate.h

Issue 250943008: Move enum MenuAnchorPosition to reduce deps on menu_item_view.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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/views_export.h"
16 18
17 using ui::OSExchangeData; 19 using ui::OSExchangeData;
18 20
19 namespace gfx { 21 namespace gfx {
20 class FontList; 22 class FontList;
23 class Point;
21 } 24 }
22 25
23 namespace ui { 26 namespace ui {
24 class Accelerator; 27 class Accelerator;
28 class DropTargetEvent;
25 } 29 }
26 30
27 namespace views { 31 namespace views {
28 32
29 class MenuButton; 33 class MenuButton;
34 class MenuItemView;
30 35
31 // MenuDelegate -------------------------------------------------------------- 36 // MenuDelegate --------------------------------------------------------------
32 37
33 // Delegate for a menu. This class is used as part of MenuItemView, see it 38 // Delegate for a menu. This class is used as part of MenuItemView, see it
34 // for details. 39 // for details.
35 // TODO(sky): merge this with ui::MenuModel. 40 // TODO(sky): merge this with ui::MenuModel.
36 class VIEWS_EXPORT MenuDelegate { 41 class VIEWS_EXPORT MenuDelegate {
37 public: 42 public:
38 // Used during drag and drop to indicate where the drop indicator should 43 // Used during drag and drop to indicate where the drop indicator should
39 // be rendered. 44 // be rendered.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 virtual void SelectionChanged(MenuItemView* menu) { 211 virtual void SelectionChanged(MenuItemView* menu) {
207 } 212 }
208 213
209 // If the user drags the mouse outside the bounds of the menu the delegate 214 // 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 215 // 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. 216 // current menu is hidden, and the menu returned from this method is shown.
212 // 217 //
213 // The delegate owns the returned menu, not the controller. 218 // The delegate owns the returned menu, not the controller.
214 virtual MenuItemView* GetSiblingMenu(MenuItemView* menu, 219 virtual MenuItemView* GetSiblingMenu(MenuItemView* menu,
215 const gfx::Point& screen_point, 220 const gfx::Point& screen_point,
216 MenuItemView::AnchorPosition* anchor, 221 ui::MenuAnchorPosition* anchor,
217 bool* has_mnemonics, 222 bool* has_mnemonics,
218 MenuButton** button); 223 MenuButton** button);
219 224
220 // Returns the max width menus can grow to be. 225 // Returns the max width menus can grow to be.
221 virtual int GetMaxWidthForMenu(MenuItemView* menu); 226 virtual int GetMaxWidthForMenu(MenuItemView* menu);
222 227
223 // Invoked prior to a menu being shown. 228 // Invoked prior to a menu being shown.
224 virtual void WillShowMenu(MenuItemView* menu); 229 virtual void WillShowMenu(MenuItemView* menu);
225 230
226 // Invoked prior to a menu being hidden. 231 // Invoked prior to a menu being hidden.
227 virtual void WillHideMenu(MenuItemView* menu); 232 virtual void WillHideMenu(MenuItemView* menu);
228 233
229 // Returns additional horizontal spacing for the icon of the given item. 234 // 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 235 // 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| 236 // function the size of the icon and it will then return |left_margin|
232 // and |right_margin| accordingly. Note: Negative values can be returned. 237 // and |right_margin| accordingly. Note: Negative values can be returned.
233 virtual void GetHorizontalIconMargins(int command_id, 238 virtual void GetHorizontalIconMargins(int command_id,
234 int icon_size, 239 int icon_size,
235 int* left_margin, 240 int* left_margin,
236 int* right_margin) const; 241 int* right_margin) const;
237 // Returns true if the labels should reserve additional spacing for e.g. 242 // Returns true if the labels should reserve additional spacing for e.g.
238 // submenu indicators at the end of the line. 243 // submenu indicators at the end of the line.
239 virtual bool ShouldReserveSpaceForSubmenuIndicator() const; 244 virtual bool ShouldReserveSpaceForSubmenuIndicator() const;
240 }; 245 };
241 246
242 } // namespace views 247 } // namespace views
243 248
244 #endif // UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ 249 #endif // UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698