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

Side by Side Diff: ui/views/controls/menu/menu_controller.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 indent 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_CONTROLLER_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <list> 10 #include <list>
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "ui/events/event.h"
17 #include "ui/events/event_constants.h" 18 #include "ui/events/event_constants.h"
18 #include "ui/events/platform/platform_event_dispatcher.h" 19 #include "ui/events/platform/platform_event_dispatcher.h"
20 #include "ui/views/controls/menu/menu_config.h"
19 #include "ui/views/controls/menu/menu_delegate.h" 21 #include "ui/views/controls/menu/menu_delegate.h"
20 #include "ui/views/controls/menu/menu_item_view.h"
21 #include "ui/views/widget/widget_observer.h" 22 #include "ui/views/widget/widget_observer.h"
22 23
23 namespace base { 24 namespace base {
24 class MessagePumpDispatcher; 25 class MessagePumpDispatcher;
25 } 26 }
26 namespace gfx { 27 namespace gfx {
27 class Screen; 28 class Screen;
28 } 29 }
29 namespace ui { 30 namespace ui {
30 class NativeTheme; 31 class NativeTheme;
31 class OSExchangeData; 32 class OSExchangeData;
32 class ScopedEventDispatcher; 33 class ScopedEventDispatcher;
33 } 34 }
34 namespace views { 35 namespace views {
35 36
36 class MenuButton; 37 class MenuButton;
37 class MenuHostRootView; 38 class MenuHostRootView;
39 class MenuItemView;
38 class MouseEvent; 40 class MouseEvent;
39 class SubmenuView; 41 class SubmenuView;
40 class View; 42 class View;
41 43
42 namespace internal { 44 namespace internal {
43 class MenuControllerDelegate; 45 class MenuControllerDelegate;
44 class MenuEventDispatcher; 46 class MenuEventDispatcher;
45 class MenuMessagePumpDispatcher; 47 class MenuMessagePumpDispatcher;
46 class MenuRunnerImpl; 48 class MenuRunnerImpl;
47 } 49 }
(...skipping 24 matching lines...) Expand all
72 // If a menu is currently active, this returns the controller for it. 74 // If a menu is currently active, this returns the controller for it.
73 static MenuController* GetActiveInstance(); 75 static MenuController* GetActiveInstance();
74 76
75 // Runs the menu at the specified location. If the menu was configured to 77 // Runs the menu at the specified location. If the menu was configured to
76 // block, the selected item is returned. If the menu does not block this 78 // block, the selected item is returned. If the menu does not block this
77 // returns NULL immediately. 79 // returns NULL immediately.
78 MenuItemView* Run(Widget* parent, 80 MenuItemView* Run(Widget* parent,
79 MenuButton* button, 81 MenuButton* button,
80 MenuItemView* root, 82 MenuItemView* root,
81 const gfx::Rect& bounds, 83 const gfx::Rect& bounds,
82 MenuItemView::AnchorPosition position, 84 MenuAnchorPosition position,
83 bool context_menu, 85 bool context_menu,
84 int* event_flags); 86 int* event_flags);
85 87
86 // Whether or not Run blocks. 88 // Whether or not Run blocks.
87 bool IsBlockingRun() const { return blocking_run_; } 89 bool IsBlockingRun() const { return blocking_run_; }
88 90
89 // Whether or not drag operation is in progress. 91 // Whether or not drag operation is in progress.
90 bool drag_in_progress() const { return drag_in_progress_; } 92 bool drag_in_progress() const { return drag_in_progress_; }
91 93
92 // Get the anchor position wich is used to show this menu. 94 // Get the anchor position wich is used to show this menu.
93 MenuItemView::AnchorPosition GetAnchorPosition() { return state_.anchor; } 95 MenuAnchorPosition GetAnchorPosition() { return state_.anchor; }
94 96
95 // Cancels the current Run. See ExitType for a description of what happens 97 // Cancels the current Run. See ExitType for a description of what happens
96 // with the various parameters. 98 // with the various parameters.
97 void Cancel(ExitType type); 99 void Cancel(ExitType type);
98 100
99 // An alternative to Cancel(EXIT_ALL) that can be used with a OneShotTimer. 101 // An alternative to Cancel(EXIT_ALL) that can be used with a OneShotTimer.
100 void CancelAll() { Cancel(EXIT_ALL); } 102 void CancelAll() { Cancel(EXIT_ALL); }
101 103
102 // Returns the current exit type. This returns a value other than EXIT_NONE if 104 // Returns the current exit type. This returns a value other than EXIT_NONE if
103 // the menu is being canceled. 105 // the menu is being canceled.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // The selected menu item. 194 // The selected menu item.
193 MenuItemView* item; 195 MenuItemView* item;
194 196
195 // If item has a submenu this indicates if the submenu is showing. 197 // If item has a submenu this indicates if the submenu is showing.
196 bool submenu_open; 198 bool submenu_open;
197 199
198 // Bounds passed to the run menu. Used for positioning the first menu. 200 // Bounds passed to the run menu. Used for positioning the first menu.
199 gfx::Rect initial_bounds; 201 gfx::Rect initial_bounds;
200 202
201 // Position of the initial menu. 203 // Position of the initial menu.
202 MenuItemView::AnchorPosition anchor; 204 MenuAnchorPosition anchor;
203 205
204 // The direction child menus have opened in. 206 // The direction child menus have opened in.
205 std::list<bool> open_leading; 207 std::list<bool> open_leading;
206 208
207 // Bounds for the monitor we're showing on. 209 // Bounds for the monitor we're showing on.
208 gfx::Rect monitor_bounds; 210 gfx::Rect monitor_bounds;
209 211
210 // Is the current menu a context menu. 212 // Is the current menu a context menu.
211 bool context_menu; 213 bool context_menu;
212 }; 214 };
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 275
274 // Runs the platform specific bits of the message loop. If |nested_menu| is 276 // Runs the platform specific bits of the message loop. If |nested_menu| is
275 // true we're being asked to run a menu from within a menu (eg a context 277 // true we're being asked to run a menu from within a menu (eg a context
276 // menu). 278 // menu).
277 void RunMessageLoop(bool nested_menu); 279 void RunMessageLoop(bool nested_menu);
278 280
279 // AcceleratorPressed is invoked on the hot tracked view if it exists. 281 // AcceleratorPressed is invoked on the hot tracked view if it exists.
280 SendAcceleratorResultType SendAcceleratorToHotTrackedView(); 282 SendAcceleratorResultType SendAcceleratorToHotTrackedView();
281 283
282 void UpdateInitialLocation(const gfx::Rect& bounds, 284 void UpdateInitialLocation(const gfx::Rect& bounds,
283 MenuItemView::AnchorPosition position, 285 MenuAnchorPosition position,
284 bool context_menu); 286 bool context_menu);
285 287
286 // Invoked when the user accepts the selected item. This is only used 288 // Invoked when the user accepts the selected item. This is only used
287 // when blocking. This schedules the loop to quit. 289 // when blocking. This schedules the loop to quit.
288 void Accept(MenuItemView* item, int event_flags); 290 void Accept(MenuItemView* item, int event_flags);
289 291
290 bool ShowSiblingMenu(SubmenuView* source, const gfx::Point& mouse_location); 292 bool ShowSiblingMenu(SubmenuView* source, const gfx::Point& mouse_location);
291 293
292 // Shows a context menu for |menu_item| as a result of a located event if 294 // Shows a context menu for |menu_item| as a result of a located event if
293 // appropriate. This is invoked on long press and releasing the right mouse 295 // appropriate. This is invoked on long press and releasing the right mouse
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 bool item_selected_by_touch_; 595 bool item_selected_by_touch_;
594 596
595 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_; 597 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_;
596 598
597 DISALLOW_COPY_AND_ASSIGN(MenuController); 599 DISALLOW_COPY_AND_ASSIGN(MenuController);
598 }; 600 };
599 601
600 } // namespace views 602 } // namespace views
601 603
602 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 604 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/views/controls/combobox/combobox_unittest.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698