| OLD | NEW |
| 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_HOST_ROOT_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ |
| 7 | 7 |
| 8 #include "ui/views/widget/root_view.h" | 8 #include "ui/views/widget/root_view.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 | 11 |
| 12 class MenuController; | 12 class MenuController; |
| 13 class SubmenuView; | 13 class SubmenuView; |
| 14 | 14 |
| 15 // MenuHostRootView is the RootView of the window showing the menu. | 15 // MenuHostRootView is the RootView of the window showing the menu. |
| 16 // SubmenuView's scroll view is added as a child of MenuHostRootView. | 16 // SubmenuView's scroll view is added as a child of MenuHostRootView. |
| 17 // MenuHostRootView forwards relevant events to the MenuController. | 17 // MenuHostRootView forwards relevant events to the MenuController. |
| 18 // | 18 // |
| 19 // As all the menu items are owned by the root menu item, care must be taken | 19 // As all the menu items are owned by the root menu item, care must be taken |
| 20 // such that when MenuHostRootView is deleted it doesn't delete the menu items. | 20 // such that when MenuHostRootView is deleted it doesn't delete the menu items. |
| 21 class MenuHostRootView : public internal::RootView { | 21 class MenuHostRootView : public internal::RootView { |
| 22 public: | 22 public: |
| 23 MenuHostRootView(Widget* widget, SubmenuView* submenu); | 23 MenuHostRootView(Widget* widget, SubmenuView* submenu); |
| 24 | 24 |
| 25 void ClearSubmenu() { submenu_ = NULL; } | 25 void ClearSubmenu() { submenu_ = NULL; } |
| 26 | 26 |
| 27 // Overridden from View: | 27 // Overridden from View: |
| 28 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; | 28 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 29 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; | 29 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
| 30 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; | 30 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 31 virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE; | 31 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; |
| 32 virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE; | 32 virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE; |
| 33 virtual ui::GestureStatus OnGestureEvent(const GestureEvent& event) OVERRIDE; | 33 virtual ui::GestureStatus OnGestureEvent(const GestureEvent& event) OVERRIDE; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 // Returns the MenuController for this MenuHostRootView. | 36 // Returns the MenuController for this MenuHostRootView. |
| 37 MenuController* GetMenuController(); | 37 MenuController* GetMenuController(); |
| 38 | 38 |
| 39 // The SubmenuView we contain. | 39 // The SubmenuView we contain. |
| 40 SubmenuView* submenu_; | 40 SubmenuView* submenu_; |
| 41 | 41 |
| 42 // Whether mouse dragged/released should be forwarded to the MenuController. | 42 // Whether mouse dragged/released should be forwarded to the MenuController. |
| 43 bool forward_drag_to_menu_controller_; | 43 bool forward_drag_to_menu_controller_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(MenuHostRootView); | 45 DISALLOW_COPY_AND_ASSIGN(MenuHostRootView); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace views | 48 } // namespace views |
| 49 | 49 |
| 50 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ | 50 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ |
| OLD | NEW |