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

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

Issue 11742012: views: Make sure the event flags are used correctly for all events that select a menu item. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Runs the menu at the specified location. If the menu was configured to 72 // Runs the menu at the specified location. If the menu was configured to
73 // block, the selected item is returned. If the menu does not block this 73 // block, the selected item is returned. If the menu does not block this
74 // returns NULL immediately. 74 // returns NULL immediately.
75 MenuItemView* Run(Widget* parent, 75 MenuItemView* Run(Widget* parent,
76 MenuButton* button, 76 MenuButton* button,
77 MenuItemView* root, 77 MenuItemView* root,
78 const gfx::Rect& bounds, 78 const gfx::Rect& bounds,
79 MenuItemView::AnchorPosition position, 79 MenuItemView::AnchorPosition position,
80 bool context_menu, 80 bool context_menu,
81 int* mouse_event_flags); 81 int* event_flags);
82 82
83 // Whether or not Run blocks. 83 // Whether or not Run blocks.
84 bool IsBlockingRun() const { return blocking_run_; } 84 bool IsBlockingRun() const { return blocking_run_; }
85 85
86 // Whether or not drag operation is in progress. 86 // Whether or not drag operation is in progress.
87 bool drag_in_progress() const { return drag_in_progress_; } 87 bool drag_in_progress() const { return drag_in_progress_; }
88 88
89 // Cancels the current Run. See ExitType for a description of what happens 89 // Cancels the current Run. See ExitType for a description of what happens
90 // with the various parameters. 90 // with the various parameters.
91 void Cancel(ExitType type); 91 void Cancel(ExitType type);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 // AcceleratorPressed is invoked on the hot tracked view if it exists. 269 // AcceleratorPressed is invoked on the hot tracked view if it exists.
270 SendAcceleratorResultType SendAcceleratorToHotTrackedView(); 270 SendAcceleratorResultType SendAcceleratorToHotTrackedView();
271 271
272 void UpdateInitialLocation(const gfx::Rect& bounds, 272 void UpdateInitialLocation(const gfx::Rect& bounds,
273 MenuItemView::AnchorPosition position, 273 MenuItemView::AnchorPosition position,
274 bool context_menu); 274 bool context_menu);
275 275
276 // Invoked when the user accepts the selected item. This is only used 276 // Invoked when the user accepts the selected item. This is only used
277 // when blocking. This schedules the loop to quit. 277 // when blocking. This schedules the loop to quit.
278 void Accept(MenuItemView* item, int mouse_event_flags); 278 void Accept(MenuItemView* item, int event_flags);
279 279
280 bool ShowSiblingMenu(SubmenuView* source, const gfx::Point& mouse_location); 280 bool ShowSiblingMenu(SubmenuView* source, const gfx::Point& mouse_location);
281 281
282 // Shows a context menu for |menu_item| as a result of a located event if 282 // Shows a context menu for |menu_item| as a result of a located event if
283 // appropriate. This is invoked on long press and releasing the right mouse 283 // appropriate. This is invoked on long press and releasing the right mouse
284 // button. Returns whether a context menu was shown. 284 // button. Returns whether a context menu was shown.
285 bool ShowContextMenu(MenuItemView* menu_item, 285 bool ShowContextMenu(MenuItemView* menu_item,
286 SubmenuView* source, 286 SubmenuView* source,
287 const ui::LocatedEvent& event); 287 const ui::LocatedEvent& event);
288 288
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // pending_state_ is committed to state_, potentially resulting in 483 // pending_state_ is committed to state_, potentially resulting in
484 // opening or closing submenus. This gives a slight delayed effect to 484 // opening or closing submenus. This gives a slight delayed effect to
485 // submenus as the user moves the mouse around. This is done so that as the 485 // submenus as the user moves the mouse around. This is done so that as the
486 // user moves the mouse all submenus don't immediately pop. 486 // user moves the mouse all submenus don't immediately pop.
487 State pending_state_; 487 State pending_state_;
488 State state_; 488 State state_;
489 489
490 // If the user accepted the selection, this is the result. 490 // If the user accepted the selection, this is the result.
491 MenuItemView* result_; 491 MenuItemView* result_;
492 492
493 // The mouse event flags when the user clicked on a menu. Is 0 if the 493 // The event flags when the user selected the menu.
494 // user did not use the mouse to select the menu. 494 int accept_event_flags_;
495 int result_mouse_event_flags_;
496 495
497 // If not empty, it means we're nested. When Run is invoked from within 496 // If not empty, it means we're nested. When Run is invoked from within
498 // Run, the current state (state_) is pushed onto menu_stack_. This allows 497 // Run, the current state (state_) is pushed onto menu_stack_. This allows
499 // MenuController to restore the state when the nested run returns. 498 // MenuController to restore the state when the nested run returns.
500 std::list<State> menu_stack_; 499 std::list<State> menu_stack_;
501 500
502 // As the mouse moves around submenus are not opened immediately. Instead 501 // As the mouse moves around submenus are not opened immediately. Instead
503 // they open after this timer fires. 502 // they open after this timer fires.
504 base::OneShotTimer<MenuController> show_timer_; 503 base::OneShotTimer<MenuController> show_timer_;
505 504
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 int message_loop_depth_; 551 int message_loop_depth_;
553 552
554 views::MenuConfig menu_config_; 553 views::MenuConfig menu_config_;
555 554
556 DISALLOW_COPY_AND_ASSIGN(MenuController); 555 DISALLOW_COPY_AND_ASSIGN(MenuController);
557 }; 556 };
558 557
559 } // namespace views 558 } // namespace views
560 559
561 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 560 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698