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

Side by Side Diff: views/controls/menu/menu_host_root_view.h

Issue 6685069: Disambiguate OnMouseCaptureLost from OnMouseReleased, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, fix tests, cleanup, etc. Created 9 years, 9 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 | « views/controls/menu/menu_controller.cc ('k') | views/controls/menu/menu_host_root_view.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ 5 #ifndef VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_
6 #define VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ 6 #define VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "views/widget/root_view.h" 9 #include "views/widget/root_view.h"
10 10
11 namespace views { 11 namespace views {
12 12
13 class MenuController; 13 class MenuController;
14 class SubmenuView; 14 class SubmenuView;
15 15
16 // MenuHostRootView is the RootView of the window showing the menu. 16 // MenuHostRootView is the RootView of the window showing the menu.
17 // SubmenuView's scroll view is added as a child of MenuHostRootView. 17 // SubmenuView's scroll view is added as a child of MenuHostRootView.
18 // MenuHostRootView forwards relevant events to the MenuController. 18 // MenuHostRootView forwards relevant events to the MenuController.
19 // 19 //
20 // As all the menu items are owned by the root menu item, care must be taken 20 // As all the menu items are owned by the root menu item, care must be taken
21 // such that when MenuHostRootView is deleted it doesn't delete the menu items. 21 // such that when MenuHostRootView is deleted it doesn't delete the menu items.
22 class MenuHostRootView : public RootView { 22 class MenuHostRootView : public RootView {
23 public: 23 public:
24 MenuHostRootView(Widget* widget, SubmenuView* submenu); 24 MenuHostRootView(Widget* widget, SubmenuView* submenu);
25 25
26 // When invoked subsequent events are NOT forwarded to the MenuController.
27 void suspend_events() { suspend_events_ = true; }
28
29 // Overridden from View: 26 // Overridden from View:
30 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; 27 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE;
31 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; 28 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE;
32 virtual void OnMouseReleased(const MouseEvent& event, bool canceled) OVERRIDE; 29 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE;
33 virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE; 30 virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE;
34 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE;
35 virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE; 31 virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE;
36 32
37 private: 33 private:
38 // Returns the MenuController for this MenuHostRootView. 34 // Returns the MenuController for this MenuHostRootView.
39 MenuController* GetMenuController(); 35 MenuController* GetMenuController();
40 36
41 // The SubmenuView we contain. 37 // The SubmenuView we contain.
42 SubmenuView* submenu_; 38 SubmenuView* submenu_;
43 39
44 // Whether mouse dragged/released should be forwarded to the MenuController. 40 // Whether mouse dragged/released should be forwarded to the MenuController.
45 bool forward_drag_to_menu_controller_; 41 bool forward_drag_to_menu_controller_;
46 42
47 // Whether events are suspended. If true, no events are forwarded to the
48 // MenuController.
49 bool suspend_events_;
50
51 DISALLOW_COPY_AND_ASSIGN(MenuHostRootView); 43 DISALLOW_COPY_AND_ASSIGN(MenuHostRootView);
52 }; 44 };
53 45
54 } // namespace views 46 } // namespace views
55 47
56 #endif // VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ 48 #endif // VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_
OLDNEW
« no previous file with comments | « views/controls/menu/menu_controller.cc ('k') | views/controls/menu/menu_host_root_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698