OLD | NEW |
1 // Copyright (c) 2009 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 | |
6 #ifndef VIEWS_CONTROLS_MENU_MENU_HOST_WIN_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_HOST_WIN_H_ |
7 #define VIEWS_CONTROLS_MENU_MENU_HOST_WIN_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_HOST_WIN_H_ |
8 #pragma once | 7 #pragma once |
9 | 8 |
10 #include "views/controls/menu/menu_host.h" | 9 #include "views/controls/menu/menu_host.h" |
11 #include "views/widget/widget_win.h" | 10 #include "views/widget/widget_win.h" |
12 | 11 |
13 namespace views { | 12 namespace views { |
14 | 13 |
15 class SubmenuView; | 14 class SubmenuView; |
16 | 15 |
17 // MenuHost implementation for windows. | 16 // MenuHost implementation for windows. |
18 class MenuHostWin : public WidgetWin, public MenuHost { | 17 class MenuHostWin : public WidgetWin, public MenuHost { |
19 public: | 18 public: |
20 explicit MenuHostWin(SubmenuView* submenu); | 19 explicit MenuHostWin(SubmenuView* submenu); |
21 virtual ~MenuHostWin(); | 20 virtual ~MenuHostWin(); |
22 | 21 |
23 // MenuHost overrides: | 22 // Overridden from MenuHost: |
24 virtual void InitMenuHost(HWND parent, | 23 virtual void InitMenuHost(HWND parent, |
25 const gfx::Rect& bounds, | 24 const gfx::Rect& bounds, |
26 View* contents_view, | 25 View* contents_view, |
27 bool do_capture); | 26 bool do_capture) OVERRIDE; |
28 virtual bool IsMenuHostVisible(); | 27 virtual bool IsMenuHostVisible() OVERRIDE; |
29 virtual void ShowMenuHost(bool do_capture); | 28 virtual void ShowMenuHost(bool do_capture) OVERRIDE; |
30 virtual void HideMenuHost(); | 29 virtual void HideMenuHost() OVERRIDE; |
31 virtual void DestroyMenuHost(); | 30 virtual void DestroyMenuHost() OVERRIDE; |
32 virtual void SetMenuHostBounds(const gfx::Rect& bounds); | 31 virtual void SetMenuHostBounds(const gfx::Rect& bounds) OVERRIDE; |
33 virtual void ReleaseMenuHostCapture(); | 32 virtual void ReleaseMenuHostCapture() OVERRIDE; |
34 virtual gfx::NativeWindow GetMenuHostWindow(); | 33 virtual gfx::NativeWindow GetMenuHostWindow() OVERRIDE; |
35 | 34 |
36 // WidgetWin overrides: | 35 // Overridden from WidgetWin: |
37 virtual void OnDestroy(); | 36 virtual void OnDestroy() OVERRIDE; |
38 virtual void OnCaptureChanged(HWND hwnd); | 37 virtual void OnCaptureChanged(HWND hwnd) OVERRIDE; |
39 virtual void OnCancelMode(); | 38 virtual void OnCancelMode() OVERRIDE; |
40 | 39 |
41 protected: | 40 protected: |
42 virtual RootView* CreateRootView(); | 41 // Overridden from Widget: |
| 42 virtual RootView* CreateRootView() OVERRIDE; |
43 | 43 |
44 // Overriden to return false, we do NOT want to release capture on mouse | 44 // Overridden from NativeWidget: |
45 // release. | 45 virtual bool ShouldReleaseCaptureOnMouseReleased() const OVERRIDE; |
46 virtual bool ReleaseCaptureOnMouseReleased(); | |
47 | 46 |
48 private: | 47 private: |
49 void DoCapture(); | 48 void DoCapture(); |
50 | 49 |
51 // If true, DestroyMenuHost has been invoked. | 50 // If true, DestroyMenuHost has been invoked. |
52 bool destroying_; | 51 bool destroying_; |
53 | 52 |
54 // If true, we own the capture and need to release it. | 53 // If true, we own the capture and need to release it. |
55 bool owns_capture_; | 54 bool owns_capture_; |
56 | 55 |
57 // The view we contain. | 56 // The view we contain. |
58 SubmenuView* submenu_; | 57 SubmenuView* submenu_; |
59 | 58 |
60 DISALLOW_COPY_AND_ASSIGN(MenuHostWin); | 59 DISALLOW_COPY_AND_ASSIGN(MenuHostWin); |
61 }; | 60 }; |
62 | 61 |
63 } // namespace views | 62 } // namespace views |
64 | 63 |
65 #endif // VIEWS_CONTROLS_MENU_MENU_HOST_WIN_H_ | 64 #endif // VIEWS_CONTROLS_MENU_MENU_HOST_WIN_H_ |
OLD | NEW |