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 UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 5 #ifndef UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
6 #define UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 6 #define UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "ui/base/accessibility/accessibility_types.h" | 10 #include "ui/base/accessibility/accessibility_types.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // dialog box Window. The window that is displayed uses this interface to | 24 // dialog box Window. The window that is displayed uses this interface to |
25 // determine how it should be displayed and notify the delegate object of | 25 // determine how it should be displayed and notify the delegate object of |
26 // certain events. | 26 // certain events. |
27 // | 27 // |
28 /////////////////////////////////////////////////////////////////////////////// | 28 /////////////////////////////////////////////////////////////////////////////// |
29 class VIEWS_EXPORT DialogDelegate : public ui::DialogModel, | 29 class VIEWS_EXPORT DialogDelegate : public ui::DialogModel, |
30 public WidgetDelegate { | 30 public WidgetDelegate { |
31 public: | 31 public: |
32 virtual ~DialogDelegate(); | 32 virtual ~DialogDelegate(); |
33 | 33 |
34 // Returns whether to use the new dialog style in general. | |
35 // See UseNewStyleForThisDialog() for dialog-specific styling. | |
36 // TODO(msw): Remove this. The new dialog style is always on by default. | |
37 static bool UseNewStyle(); | |
38 | |
39 // Create a |dialog| window Widget with the specified |context| or |parent|. | 34 // Create a |dialog| window Widget with the specified |context| or |parent|. |
40 static Widget* CreateDialogWidget(DialogDelegate* dialog, | 35 static Widget* CreateDialogWidget(DialogDelegate* dialog, |
41 gfx::NativeWindow context, | 36 gfx::NativeWindow context, |
42 gfx::NativeWindow parent); | 37 gfx::NativeWindow parent); |
43 | 38 |
44 // Override this function to display an extra view adjacent to the buttons. | 39 // Override this function to display an extra view adjacent to the buttons. |
45 // Overrides may construct the view; this will only be called once per dialog. | 40 // Overrides may construct the view; this will only be called once per dialog. |
46 virtual View* CreateExtraView(); | 41 virtual View* CreateExtraView(); |
47 | 42 |
48 // Override this function to display an extra view in the titlebar. | 43 // Override this function to display an extra view in the titlebar. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ui::DialogButton button) const OVERRIDE; | 83 ui::DialogButton button) const OVERRIDE; |
89 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 84 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
90 | 85 |
91 // Overridden from WidgetDelegate: | 86 // Overridden from WidgetDelegate: |
92 virtual View* GetInitiallyFocusedView() OVERRIDE; | 87 virtual View* GetInitiallyFocusedView() OVERRIDE; |
93 virtual DialogDelegate* AsDialogDelegate() OVERRIDE; | 88 virtual DialogDelegate* AsDialogDelegate() OVERRIDE; |
94 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; | 89 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; |
95 virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; | 90 virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; |
96 | 91 |
97 // Create a frame view using the new dialog style. | 92 // Create a frame view using the new dialog style. |
98 static NonClientFrameView* CreateNewStyleFrameView(Widget* widget); | 93 static NonClientFrameView* CreateDialogFrameView(Widget* widget); |
99 // The semi-transparent border and shadow of the new style frame view does not | 94 // The semi-transparent border and shadow of the new style frame view does not |
100 // work on child windows under Views/Win32. This is a kludge to get a | 95 // work on child windows under Views/Win32. This is a kludge to get a |
101 // reasonable-looking opaque border for the dialog. Note that this does not | 96 // reasonable-looking opaque border for the dialog. Note that this does not |
102 // support arrows. | 97 // support arrows. |
103 // | 98 // |
104 // TODO(wittman): Remove once WinAura is in place. | 99 // TODO(wittman): Remove once WinAura is in place. |
105 static NonClientFrameView* CreateNewStyleFrameView(Widget* widget, | 100 static NonClientFrameView* CreateDialogFrameView(Widget* widget, |
106 bool force_opaque_border); | 101 bool force_opaque_border); |
107 | 102 |
108 // Returns whether this particular dialog should use the new dialog style. | 103 // Returns whether this particular dialog should use the new dialog style. |
109 virtual bool UseNewStyleForThisDialog() const; | 104 virtual bool UseNewStyleForThisDialog() const; |
110 | 105 |
111 // Called when the window has been closed. | 106 // Called when the window has been closed. |
112 virtual void OnClosed() {} | 107 virtual void OnClosed() {} |
113 | 108 |
114 // A helper for accessing the DialogClientView object contained by this | 109 // A helper for accessing the DialogClientView object contained by this |
115 // delegate's Window. | 110 // delegate's Window. |
116 const DialogClientView* GetDialogClientView() const; | 111 const DialogClientView* GetDialogClientView() const; |
(...skipping 20 matching lines...) Expand all Loading... |
137 virtual const Widget* GetWidget() const OVERRIDE; | 132 virtual const Widget* GetWidget() const OVERRIDE; |
138 virtual View* GetContentsView() OVERRIDE; | 133 virtual View* GetContentsView() OVERRIDE; |
139 | 134 |
140 private: | 135 private: |
141 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); | 136 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); |
142 }; | 137 }; |
143 | 138 |
144 } // namespace views | 139 } // namespace views |
145 | 140 |
146 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 141 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
OLD | NEW |