| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "ui/accessibility/ax_enums.h" | 11 #include "ui/accessibility/ax_enums.h" |
| 12 #include "ui/base/models/dialog_model.h" | 12 #include "ui/base/models/dialog_model.h" |
| 13 #include "ui/base/ui_base_types.h" | 13 #include "ui/base/ui_base_types.h" |
| 14 #include "ui/views/widget/widget.h" |
| 14 #include "ui/views/widget/widget_delegate.h" | 15 #include "ui/views/widget/widget_delegate.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 | 18 |
| 18 class DialogClientView; | 19 class DialogClientView; |
| 19 class LabelButton; | 20 class LabelButton; |
| 20 | 21 |
| 21 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
| 22 // | 23 // |
| 23 // DialogDelegate | 24 // DialogDelegate |
| 24 // | 25 // |
| 25 // DialogDelegate is an interface implemented by objects that wish to show a | 26 // DialogDelegate is an interface implemented by objects that wish to show a |
| 26 // dialog box Window. The window that is displayed uses this interface to | 27 // dialog box Window. The window that is displayed uses this interface to |
| 27 // determine how it should be displayed and notify the delegate object of | 28 // determine how it should be displayed and notify the delegate object of |
| 28 // certain events. | 29 // certain events. |
| 29 // | 30 // |
| 30 /////////////////////////////////////////////////////////////////////////////// | 31 /////////////////////////////////////////////////////////////////////////////// |
| 31 class VIEWS_EXPORT DialogDelegate : public ui::DialogModel, | 32 class VIEWS_EXPORT DialogDelegate : public ui::DialogModel, |
| 32 public WidgetDelegate { | 33 public WidgetDelegate { |
| 33 public: | 34 public: |
| 34 DialogDelegate(); | 35 DialogDelegate(); |
| 35 ~DialogDelegate() override; | 36 ~DialogDelegate() override; |
| 36 | 37 |
| 37 // Same as CreateDialogWidgetWithBounds() with an empty |bounds|. | 38 // Creates a widget at a default location. |
| 38 static Widget* CreateDialogWidget(WidgetDelegate* delegate, | 39 static Widget* CreateDialogWidget(WidgetDelegate* delegate, |
| 39 gfx::NativeWindow context, | 40 gfx::NativeWindow context, |
| 40 gfx::NativeView parent); | 41 gfx::NativeView parent); |
| 41 | 42 |
| 42 // Create a dialog widget with the specified |context| or |parent|. | 43 // Returns the dialog widget InitParams for a given |context| or |parent|. |
| 43 // If |bounds| is not empty, used to initially place the dialog, otherwise | 44 // If |bounds| is not empty, used to initially place the dialog, otherwise |
| 44 // a default location is used. | 45 // a default location is used. |
| 45 static Widget* CreateDialogWidgetWithBounds(WidgetDelegate* delegate, | 46 static Widget::InitParams GetDialogWidgetInitParams(WidgetDelegate* delegate, |
| 46 gfx::NativeWindow context, | 47 gfx::NativeWindow context, |
| 47 gfx::NativeView parent, | 48 gfx::NativeView parent, |
| 48 const gfx::Rect& bounds); | 49 const gfx::Rect& bounds); |
| 49 | 50 |
| 50 // Override this function to display an extra view adjacent to the buttons. | 51 // Override this function to display an extra view adjacent to the buttons. |
| 51 // Overrides may construct the view; this will only be called once per dialog. | 52 // Overrides may construct the view; this will only be called once per dialog. |
| 52 virtual View* CreateExtraView(); | 53 virtual View* CreateExtraView(); |
| 53 | 54 |
| 54 // Override this function to adjust the padding between the extra view and | 55 // Override this function to adjust the padding between the extra view and |
| 55 // the confirm/cancel buttons. Note that if there are no buttons, this will | 56 // the confirm/cancel buttons. Note that if there are no buttons, this will |
| 56 // not be used. | 57 // not be used. |
| 57 // If a custom padding should be used, returns true and populates |padding|. | 58 // If a custom padding should be used, returns true and populates |padding|. |
| 58 virtual bool GetExtraViewPadding(int* padding); | 59 virtual bool GetExtraViewPadding(int* padding); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 void ViewHierarchyChanged( | 144 void ViewHierarchyChanged( |
| 144 const ViewHierarchyChangedDetails& details) override; | 145 const ViewHierarchyChangedDetails& details) override; |
| 145 | 146 |
| 146 private: | 147 private: |
| 147 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); | 148 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); |
| 148 }; | 149 }; |
| 149 | 150 |
| 150 } // namespace views | 151 } // namespace views |
| 151 | 152 |
| 152 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 153 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
| OLD | NEW |