Demonstrate the basic functionality of the File System
[chromium-blink-merge.git] / ui / views / controls / menu / menu_host_root_view.h
blob16f59efcf9384ad1769dc3743cdd829a0c06337e
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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_
8 #include "ui/views/widget/root_view.h"
10 namespace views {
12 class MenuController;
13 class SubmenuView;
15 // MenuHostRootView is the RootView of the window showing the menu.
16 // SubmenuView's scroll view is added as a child of MenuHostRootView.
17 // MenuHostRootView forwards relevant events to the MenuController.
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.
21 class MenuHostRootView : public internal::RootView {
22 public:
23 MenuHostRootView(Widget* widget, SubmenuView* submenu);
25 void ClearSubmenu() { submenu_ = NULL; }
27 // Overridden from View:
28 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
29 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE;
30 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
31 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE;
32 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
34 // Overridden from internal::RootView:
35 virtual void DispatchGestureEvent(ui::GestureEvent* e) OVERRIDE;
37 private:
38 // Returns the MenuController for this MenuHostRootView.
39 MenuController* GetMenuController();
41 // Returns true if event targets EmptyMenu.
42 bool DoesEventTargetEmptyMenuItem(const ui::MouseEvent& event);
44 // The SubmenuView we contain.
45 SubmenuView* submenu_;
47 // Whether mouse dragged/released should be forwarded to the MenuController.
48 bool forward_drag_to_menu_controller_;
50 DISALLOW_COPY_AND_ASSIGN(MenuHostRootView);
53 } // namespace views
55 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_