| 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_delegate.h" | 14 #include "ui/views/widget/widget_delegate.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 | 17 |
| 18 class DialogClientView; | 18 class DialogClientView; |
| 19 class LabelButton; |
| 19 | 20 |
| 20 /////////////////////////////////////////////////////////////////////////////// | 21 /////////////////////////////////////////////////////////////////////////////// |
| 21 // | 22 // |
| 22 // DialogDelegate | 23 // DialogDelegate |
| 23 // | 24 // |
| 24 // DialogDelegate is an interface implemented by objects that wish to show a | 25 // DialogDelegate is an interface implemented by objects that wish to show a |
| 25 // dialog box Window. The window that is displayed uses this interface to | 26 // dialog box Window. The window that is displayed uses this interface to |
| 26 // determine how it should be displayed and notify the delegate object of | 27 // determine how it should be displayed and notify the delegate object of |
| 27 // certain events. | 28 // certain events. |
| 28 // | 29 // |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // can be closed after it returns, or false if it must remain open. | 74 // can be closed after it returns, or false if it must remain open. |
| 74 virtual bool Accept(); | 75 virtual bool Accept(); |
| 75 | 76 |
| 76 // Called when the user closes the window without selecting an option, | 77 // Called when the user closes the window without selecting an option, |
| 77 // e.g. by pressing the close button on the window or using a window manager | 78 // e.g. by pressing the close button on the window or using a window manager |
| 78 // gesture. By default, this calls Accept() if the only button in the dialog | 79 // gesture. By default, this calls Accept() if the only button in the dialog |
| 79 // is Accept, Cancel() otherwise. This function should return true if the | 80 // is Accept, Cancel() otherwise. This function should return true if the |
| 80 // window can be closed after it returns, or false if it must remain open. | 81 // window can be closed after it returns, or false if it must remain open. |
| 81 virtual bool Close(); | 82 virtual bool Close(); |
| 82 | 83 |
| 84 // Updates the properties and appearance of |button| which has been created |
| 85 // for type |type|. Override to do special initialization above and beyond |
| 86 // the typical. |
| 87 virtual void UpdateButton(LabelButton* button, ui::DialogButton type); |
| 88 |
| 83 // Overridden from ui::DialogModel: | 89 // Overridden from ui::DialogModel: |
| 84 base::string16 GetDialogTitle() const override; | 90 base::string16 GetDialogTitle() const override; |
| 85 int GetDialogButtons() const override; | 91 int GetDialogButtons() const override; |
| 86 int GetDefaultDialogButton() const override; | 92 int GetDefaultDialogButton() const override; |
| 87 bool ShouldDefaultButtonBeBlue() const override; | 93 bool ShouldDefaultButtonBeBlue() const override; |
| 88 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 94 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 89 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 95 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 90 | 96 |
| 91 // Overridden from WidgetDelegate: | 97 // Overridden from WidgetDelegate: |
| 92 View* GetInitiallyFocusedView() override; | 98 View* GetInitiallyFocusedView() override; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void ViewHierarchyChanged( | 141 void ViewHierarchyChanged( |
| 136 const ViewHierarchyChangedDetails& details) override; | 142 const ViewHierarchyChangedDetails& details) override; |
| 137 | 143 |
| 138 private: | 144 private: |
| 139 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); | 145 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); |
| 140 }; | 146 }; |
| 141 | 147 |
| 142 } // namespace views | 148 } // namespace views |
| 143 | 149 |
| 144 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 150 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
| OLD | NEW |