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

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

Issue 2876203003: Make shelf item can be dragged when context menu is opened.
Patch Set: Created 3 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
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // Returns the current exit type. This returns a value other than EXIT_NONE if 124 // Returns the current exit type. This returns a value other than EXIT_NONE if
125 // the menu is being canceled. 125 // the menu is being canceled.
126 ExitType exit_type() const { return exit_type_; } 126 ExitType exit_type() const { return exit_type_; }
127 127
128 // Returns the time from the event which closed the menu - or 0. 128 // Returns the time from the event which closed the menu - or 0.
129 base::TimeTicks closing_event_time() const { return closing_event_time_; } 129 base::TimeTicks closing_event_time() const { return closing_event_time_; }
130 130
131 void set_is_combobox(bool is_combobox) { is_combobox_ = is_combobox; } 131 void set_is_combobox(bool is_combobox) { is_combobox_ = is_combobox; }
132 132
133 void set_cancel_active_touches(bool cancel_active_touches) {
134 cancel_active_touches_ = cancel_active_touches;
135 }
133 // Various events, forwarded from the submenu. 136 // Various events, forwarded from the submenu.
134 // 137 //
135 // NOTE: the coordinates of the events are in that of the 138 // NOTE: the coordinates of the events are in that of the
136 // MenuScrollViewContainer. 139 // MenuScrollViewContainer.
137 bool OnMousePressed(SubmenuView* source, const ui::MouseEvent& event); 140 bool OnMousePressed(SubmenuView* source, const ui::MouseEvent& event);
138 bool OnMouseDragged(SubmenuView* source, const ui::MouseEvent& event); 141 bool OnMouseDragged(SubmenuView* source, const ui::MouseEvent& event);
139 void OnMouseReleased(SubmenuView* source, const ui::MouseEvent& event); 142 void OnMouseReleased(SubmenuView* source, const ui::MouseEvent& event);
140 void OnMouseMoved(SubmenuView* source, const ui::MouseEvent& event); 143 void OnMouseMoved(SubmenuView* source, const ui::MouseEvent& event);
141 void OnMouseEntered(SubmenuView* source, const ui::MouseEvent& event); 144 void OnMouseEntered(SubmenuView* source, const ui::MouseEvent& event);
142 bool OnMouseWheel(SubmenuView* source, const ui::MouseWheelEvent& event); 145 bool OnMouseWheel(SubmenuView* source, const ui::MouseWheelEvent& event);
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 base::TimeTicks menu_start_time_; 663 base::TimeTicks menu_start_time_;
661 664
662 // If a mouse press triggered this menu, this will have its location (in 665 // If a mouse press triggered this menu, this will have its location (in
663 // screen coordinates). Otherwise this will be (0, 0). 666 // screen coordinates). Otherwise this will be (0, 0).
664 gfx::Point menu_start_mouse_press_loc_; 667 gfx::Point menu_start_mouse_press_loc_;
665 668
666 // Controls behavior differences between a combobox and other types of menu 669 // Controls behavior differences between a combobox and other types of menu
667 // (like a context menu). 670 // (like a context menu).
668 bool is_combobox_; 671 bool is_combobox_;
669 672
673 // In order to make item can be dragged after context menu is opened. Cannot
674 // cancel existing touch events.
675 bool cancel_active_touches_ = true;
676
670 // Set to true if the menu item was selected by touch. 677 // Set to true if the menu item was selected by touch.
671 bool item_selected_by_touch_; 678 bool item_selected_by_touch_;
672 679
673 // During mouse event handling, this is the RootView to forward mouse events 680 // During mouse event handling, this is the RootView to forward mouse events
674 // to. We need this, because if we forward one event to it (e.g., mouse 681 // to. We need this, because if we forward one event to it (e.g., mouse
675 // pressed), subsequent events (like dragging) should also go to it, even if 682 // pressed), subsequent events (like dragging) should also go to it, even if
676 // the mouse is no longer over the view. 683 // the mouse is no longer over the view.
677 MenuHostRootView* current_mouse_event_target_; 684 MenuHostRootView* current_mouse_event_target_;
678 685
679 // A mask of the EventFlags for the mouse buttons currently pressed. 686 // A mask of the EventFlags for the mouse buttons currently pressed.
680 int current_mouse_pressed_state_; 687 int current_mouse_pressed_state_;
681 688
682 #if defined(USE_AURA) 689 #if defined(USE_AURA)
683 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_; 690 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_;
684 #endif 691 #endif
685 692
686 DISALLOW_COPY_AND_ASSIGN(MenuController); 693 DISALLOW_COPY_AND_ASSIGN(MenuController);
687 }; 694 };
688 695
689 } // namespace views 696 } // namespace views
690 697
691 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 698 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698