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