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

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

Issue 378333003: Allow menus to stay open during a child view's drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Fix Created 6 years, 5 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 MenuAnchorPosition position, 85 MenuAnchorPosition position,
86 bool context_menu, 86 bool context_menu,
87 int* event_flags); 87 int* event_flags);
88 88
89 // Whether or not Run blocks. 89 // Whether or not Run blocks.
90 bool IsBlockingRun() const { return blocking_run_; } 90 bool IsBlockingRun() const { return blocking_run_; }
91 91
92 // Whether or not drag operation is in progress. 92 // Whether or not drag operation is in progress.
93 bool drag_in_progress() const { return drag_in_progress_; } 93 bool drag_in_progress() const { return drag_in_progress_; }
94 94
95 // Whether the MenuController initiated the drag in progress. False if there
96 // is no drag in progress.
97 bool did_initiate_drag() const { return did_initiate_drag_; }
98
95 // Returns the owner of child windows. 99 // Returns the owner of child windows.
96 // WARNING: this may be NULL. 100 // WARNING: this may be NULL.
97 Widget* owner() { return owner_; } 101 Widget* owner() { return owner_; }
98 102
99 // Get the anchor position wich is used to show this menu. 103 // Get the anchor position wich is used to show this menu.
100 MenuAnchorPosition GetAnchorPosition() { return state_.anchor; } 104 MenuAnchorPosition GetAnchorPosition() { return state_.anchor; }
101 105
102 // Cancels the current Run. See ExitType for a description of what happens 106 // Cancels the current Run. See ExitType for a description of what happens
103 // with the various parameters. 107 // with the various parameters.
104 void Cancel(ExitType type); 108 void Cancel(ExitType type);
(...skipping 30 matching lines...) Expand all
135 bool CanDrop(SubmenuView* source, const ui::OSExchangeData& data); 139 bool CanDrop(SubmenuView* source, const ui::OSExchangeData& data);
136 void OnDragEntered(SubmenuView* source, const ui::DropTargetEvent& event); 140 void OnDragEntered(SubmenuView* source, const ui::DropTargetEvent& event);
137 int OnDragUpdated(SubmenuView* source, const ui::DropTargetEvent& event); 141 int OnDragUpdated(SubmenuView* source, const ui::DropTargetEvent& event);
138 void OnDragExited(SubmenuView* source); 142 void OnDragExited(SubmenuView* source);
139 int OnPerformDrop(SubmenuView* source, const ui::DropTargetEvent& event); 143 int OnPerformDrop(SubmenuView* source, const ui::DropTargetEvent& event);
140 144
141 // Invoked from the scroll buttons of the MenuScrollViewContainer. 145 // Invoked from the scroll buttons of the MenuScrollViewContainer.
142 void OnDragEnteredScrollButton(SubmenuView* source, bool is_up); 146 void OnDragEnteredScrollButton(SubmenuView* source, bool is_up);
143 void OnDragExitedScrollButton(SubmenuView* source); 147 void OnDragExitedScrollButton(SubmenuView* source);
144 148
149 // Called by the Widget when a drag is about to start on a child view. This
150 // could be initiated by one of our MenuItemViews, or could be through another
151 // child View.
152 void OnDragWillStart();
153
154 // Called by the Widget when the drag has completed. |should_close|
155 // corresponds to whether or not the menu should close.
156 void OnDragComplete(bool should_close);
157
145 // Update the submenu's selection based on the current mouse location 158 // Update the submenu's selection based on the current mouse location
146 void UpdateSubmenuSelection(SubmenuView* source); 159 void UpdateSubmenuSelection(SubmenuView* source);
147 160
148 // WidgetObserver overrides: 161 // WidgetObserver overrides:
149 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; 162 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE;
150 163
151 // Only used for testing. 164 // Only used for testing.
152 static void TurnOffMenuSelectionHoldForTest(); 165 static void TurnOffMenuSelectionHoldForTest();
153 166
154 private: 167 private:
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // Owner of child windows. 562 // Owner of child windows.
550 // WARNING: this may be NULL. 563 // WARNING: this may be NULL.
551 Widget* owner_; 564 Widget* owner_;
552 565
553 // Indicates a possible drag operation. 566 // Indicates a possible drag operation.
554 bool possible_drag_; 567 bool possible_drag_;
555 568
556 // True when drag operation is in progress. 569 // True when drag operation is in progress.
557 bool drag_in_progress_; 570 bool drag_in_progress_;
558 571
572 // True when the drag operation in progress was initiated by the
573 // MenuController for a child MenuItemView (as opposed to initiated separately
574 // by a child View).
575 bool did_initiate_drag_;
576
559 // Location the mouse was pressed at. Used to detect d&d. 577 // Location the mouse was pressed at. Used to detect d&d.
560 gfx::Point press_pt_; 578 gfx::Point press_pt_;
561 579
562 // We get a slew of drag updated messages as the mouse is over us. To avoid 580 // We get a slew of drag updated messages as the mouse is over us. To avoid
563 // continually processing whether we can drop, we cache the coordinates. 581 // continually processing whether we can drop, we cache the coordinates.
564 bool valid_drop_coordinates_; 582 bool valid_drop_coordinates_;
565 gfx::Point drop_pt_; 583 gfx::Point drop_pt_;
566 int last_drop_operation_; 584 int last_drop_operation_;
567 585
568 // If true, we're in the middle of invoking ShowAt on a submenu. 586 // If true, we're in the middle of invoking ShowAt on a submenu.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 bool item_selected_by_touch_; 622 bool item_selected_by_touch_;
605 623
606 scoped_ptr<MenuMessageLoop> message_loop_; 624 scoped_ptr<MenuMessageLoop> message_loop_;
607 625
608 DISALLOW_COPY_AND_ASSIGN(MenuController); 626 DISALLOW_COPY_AND_ASSIGN(MenuController);
609 }; 627 };
610 628
611 } // namespace views 629 } // namespace views
612 630
613 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 631 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698