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