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 ASH_TEST_CHILD_WMODAL_WINDOW_H_ | 5 #ifndef UI_VIEWS_TEST_CHILD_WMODAL_WINDOW_H_ |
6 #define ASH_TEST_CHILD_WMODAL_WINDOW_H_ | 6 #define UI_VIEWS_TEST_CHILD_WMODAL_WINDOW_H_ |
7 | 7 |
8 #include "ui/views/controls/button/button.h" | 8 #include "ui/views/controls/button/button.h" |
9 #include "ui/views/widget/widget_delegate.h" | 9 #include "ui/views/widget/widget_delegate.h" |
10 #include "ui/views/widget/widget_observer.h" | 10 #include "ui/views/widget/widget_observer.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 class NativeTextButton; | 13 class NativeTextButton; |
14 class NativeViewHost; | 14 class NativeViewHost; |
15 class Textfield; | 15 class Textfield; |
16 class View; | 16 class View; |
17 class Widget; | 17 class Widget; |
18 } | |
19 | |
20 namespace ash { | |
21 namespace test { | 18 namespace test { |
22 | 19 |
23 void CreateChildModalParent(); | 20 void CreateChildModalParent(); |
24 | 21 |
25 class ChildModalParent : public views::WidgetDelegateView, | 22 class ChildModalParent : public WidgetDelegateView, |
26 public views::ButtonListener, | 23 public ButtonListener, |
27 public views::WidgetObserver { | 24 public WidgetObserver { |
28 public: | 25 public: |
29 ChildModalParent(); | 26 ChildModalParent(); |
30 virtual ~ChildModalParent(); | 27 virtual ~ChildModalParent(); |
31 | 28 |
32 void ShowChild(); | 29 void ShowChild(); |
33 gfx::NativeWindow GetModalParent() const; | 30 gfx::NativeWindow GetModalParent() const; |
34 gfx::NativeWindow GetChild() const; | 31 gfx::NativeWindow GetChild() const; |
35 | 32 |
36 private: | 33 private: |
37 views::Widget* CreateChild(); | 34 Widget* CreateChild(); |
38 | 35 |
39 // Overridden from views::WidgetDelegate: | 36 // Overridden from WidgetDelegate: |
40 virtual views::View* GetContentsView() OVERRIDE; | 37 virtual View* GetContentsView() OVERRIDE; |
41 virtual string16 GetWindowTitle() const OVERRIDE; | 38 virtual string16 GetWindowTitle() const OVERRIDE; |
42 virtual bool CanResize() const OVERRIDE; | 39 virtual bool CanResize() const OVERRIDE; |
43 virtual void DeleteDelegate() OVERRIDE; | 40 virtual void DeleteDelegate() OVERRIDE; |
44 virtual void Layout() OVERRIDE; | 41 virtual void Layout() OVERRIDE; |
45 virtual void ViewHierarchyChanged(bool is_add, | 42 virtual void ViewHierarchyChanged(bool is_add, |
46 views::View* parent, | 43 View* parent, |
47 views::View* child) OVERRIDE; | 44 View* child) OVERRIDE; |
48 | 45 |
49 // Overridden from views::ButtonListener: | 46 // Overridden from ButtonListener: |
50 virtual void ButtonPressed(views::Button* sender, | 47 virtual void ButtonPressed(Button* sender, |
51 const ui::Event& event) OVERRIDE; | 48 const ui::Event& event) OVERRIDE; |
52 | 49 |
53 // Overridden from views::WidgetObserver: | 50 // Overridden from WidgetObserver: |
54 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 51 virtual void OnWidgetClosing(Widget* widget) OVERRIDE; |
55 | 52 |
56 // The button to toggle showing and hiding the child window. The child window | 53 // The button to toggle showing and hiding the child window. The child window |
57 // does not block input to this button. | 54 // does not block input to this button. |
58 views::NativeTextButton* button_; | 55 NativeTextButton* button_; |
59 | 56 |
60 // The text field to indicate the keyboard focus. | 57 // The text field to indicate the keyboard focus. |
61 views::Textfield* textfield_; | 58 Textfield* textfield_; |
62 | 59 |
63 // The host for the modal parent. | 60 // The host for the modal parent. |
64 views::NativeViewHost* host_; | 61 NativeViewHost* host_; |
65 | 62 |
66 // The modal parent of the child window. The child window blocks input to this | 63 // The modal parent of the child window. The child window blocks input to this |
67 // view. | 64 // view. |
68 gfx::NativeWindow modal_parent_; | 65 gfx::NativeWindow modal_parent_; |
69 | 66 |
70 // The child window. | 67 // The child window. |
71 views::Widget* child_; | 68 Widget* child_; |
72 | 69 |
73 DISALLOW_COPY_AND_ASSIGN(ChildModalParent); | 70 DISALLOW_COPY_AND_ASSIGN(ChildModalParent); |
74 }; | 71 }; |
75 | 72 |
76 } // namespace test | 73 } // namespace test |
77 } // namespace ash | 74 } // namespace views |
78 | 75 |
79 #endif // ASH_TEST_CHILD_WMODAL_WINDOW_H_ | 76 #endif // UI_VIEWS_TEST_CHILD_WMODAL_WINDOW_H_ |
OLD | NEW |