| 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" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // 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 |
| 57 // not be used. | 57 // not be used. |
| 58 // 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|. |
| 59 virtual bool GetExtraViewPadding(int* padding); | 59 virtual bool GetExtraViewPadding(int* padding); |
| 60 | 60 |
| 61 // Override this function to display a footnote view below the buttons. | 61 // Override this function to display a footnote view below the buttons. |
| 62 // Overrides may construct the view; this will only be called once per dialog. | 62 // Overrides may construct the view; this will only be called once per dialog. |
| 63 virtual View* CreateFootnoteView(); | 63 virtual View* CreateFootnoteView(); |
| 64 | 64 |
| 65 // For Dialog boxes, if there is a "Cancel" button or no dialog button at all, | 65 // For Dialog boxes, if there is a "Cancel" button or no dialog button at all, |
| 66 // this is called when the user presses the "Cancel" button or the Esc key. | 66 // this is called when the user presses the "Cancel" button. |
| 67 // It can also be called on a close action if |Close| has not been | 67 // It can also be called on a close action if |Close| has not been |
| 68 // overridden. This function should return true if the window can be closed | 68 // overridden. This function should return true if the window can be closed |
| 69 // after it returns, or false if it must remain open. | 69 // after it returns, or false if it must remain open. |
| 70 virtual bool Cancel(); | 70 virtual bool Cancel(); |
| 71 | 71 |
| 72 // For Dialog boxes, this is called when the user presses the "OK" button, | 72 // For Dialog boxes, this is called when the user presses the "OK" button, |
| 73 // or the Enter key. It can also be called on a close action if |Close| | 73 // or the Enter key. It can also be called on a close action if |Close| |
| 74 // has not been overridden. This function should return true if the window | 74 // has not been overridden. This function should return true if the window |
| 75 // can be closed after it returns, or false if it must remain open. | 75 // can be closed after it returns, or false if it must remain open. |
| 76 virtual bool Accept(); | 76 virtual bool Accept(); |
| 77 | 77 |
| 78 // Called when the user closes the window without selecting an option, | 78 // Called when the user closes the window without selecting an option, |
| 79 // e.g. by pressing the close button on the window or using a window manager | 79 // e.g. by pressing the close button on the window, pressing the Esc key, or |
| 80 // gesture. By default, this calls Accept() if the only button in the dialog | 80 // using a window manager gesture. By default, this calls Accept() if the only |
| 81 // is Accept, Cancel() otherwise. This function should return true if the | 81 // button in the dialog is Accept, Cancel() otherwise. This function should |
| 82 // window can be closed after it returns, or false if it must remain open. | 82 // return true if the window can be closed after it returns, or false if it |
| 83 // must remain open. |
| 83 virtual bool Close(); | 84 virtual bool Close(); |
| 84 | 85 |
| 85 // Updates the properties and appearance of |button| which has been created | 86 // Updates the properties and appearance of |button| which has been created |
| 86 // for type |type|. Override to do special initialization above and beyond | 87 // for type |type|. Override to do special initialization above and beyond |
| 87 // the typical. | 88 // the typical. |
| 88 virtual void UpdateButton(LabelButton* button, ui::DialogButton type); | 89 virtual void UpdateButton(LabelButton* button, ui::DialogButton type); |
| 89 | 90 |
| 90 // Overridden from ui::DialogModel: | 91 // Overridden from ui::DialogModel: |
| 91 int GetDialogButtons() const override; | 92 int GetDialogButtons() const override; |
| 92 int GetDefaultDialogButton() const override; | 93 int GetDefaultDialogButton() const override; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void ViewHierarchyChanged( | 145 void ViewHierarchyChanged( |
| 145 const ViewHierarchyChangedDetails& details) override; | 146 const ViewHierarchyChangedDetails& details) override; |
| 146 | 147 |
| 147 private: | 148 private: |
| 148 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); | 149 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 } // namespace views | 152 } // namespace views |
| 152 | 153 |
| 153 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 154 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
| OLD | NEW |