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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 // Override this function to display an extra view in the titlebar. | 47 // Override this function to display an extra view in the titlebar. |
48 // Overrides may construct the view; this will only be called once per dialog. | 48 // Overrides may construct the view; this will only be called once per dialog. |
49 // Note: this only works for new style dialogs. | 49 // Note: this only works for new style dialogs. |
50 virtual View* CreateTitlebarExtraView(); | 50 virtual View* CreateTitlebarExtraView(); |
51 | 51 |
52 // Override this function to display a footnote view below the buttons. | 52 // Override this function to display a footnote view below the buttons. |
53 // Overrides may construct the view; this will only be called once per dialog. | 53 // Overrides may construct the view; this will only be called once per dialog. |
54 virtual View* CreateFootnoteView(); | 54 virtual View* CreateFootnoteView(); |
55 | 55 |
56 // For Dialog boxes, if there is a "Cancel" button or no dialog button at all, | 56 // For Dialog boxes, if there is a "Cancel" button or no dialog button at all, |
57 // this is called when the user presses the "Cancel" button or the Close | 57 // this is called when the user presses the "Cancel" button or the Esc key. |
58 // button on the window or in the system menu, or presses the Esc key. | 58 // It can also be called on a dismiss action if |Dismiss| has not been |
59 // This function should return true if the window can be closed after it | 59 // overridden. This function should return true if the window can be closed |
60 // returns, or false if it must remain open. | 60 // after it returns, or false if it must remain open. |
61 virtual bool Cancel(); | 61 virtual bool Cancel(); |
62 | 62 |
63 // For Dialog boxes, this is called when the user presses the "OK" button, | 63 // For Dialog boxes, this is called when the user presses the "OK" button, |
64 // or the Enter key. Can also be called on Esc key or close button | 64 // or the Enter key. It can also be called on a dismiss action if |Dismiss| |
65 // presses if there is no "Cancel" button. This function should return | 65 // has not been overridden. This function should return true if the window |
66 // true if the window can be closed after it returns, or false if it must | 66 // can be closed after it returns, or false if it must remain open. |
67 // remain open. If |window_closing| is true, it means that this handler is | 67 // If |window_closing| is true, it means that this handler is |
68 // being called because the window is being closed (e.g. by Window::Close) | 68 // being called because the window is being closed (e.g. by Window::Close) |
69 // and there is no Cancel handler, so Accept is being called instead. | 69 // and there is no Cancel handler, so Accept is being called instead. |
70 virtual bool Accept(bool window_closing); | 70 virtual bool Accept(bool window_closing); |
71 virtual bool Accept(); | 71 virtual bool Accept(); |
72 | 72 |
73 // For Dialog boxes, this is called when the user presses the Close button | |
74 // on the window or in the system menu. The default behavior is to call | |
75 // |Cancel| if the dialog has a "Cancel" button or no button at all, or | |
76 // |Accept| otherwise. This function should return true if the window can be | |
77 // closed after it returns, or false if it must remain open. | |
78 virtual bool Dismiss(); | |
Ben Goodger (Google)
2013/07/23 17:52:09
Can we call this "Close()"? That is more in keepin
fdoray
2013/07/24 15:09:16
Yes... but there is a |OnClose| method in DialogDe
Ben Goodger (Google)
2013/07/24 17:56:21
I'd change the notification below to OnClosed() (p
fdoray
2013/07/24 20:21:07
Done.
Little concern about using a verb: as I sai
| |
79 | |
73 // Overridden from ui::DialogModel: | 80 // Overridden from ui::DialogModel: |
74 virtual base::string16 GetDialogLabel() const OVERRIDE; | 81 virtual base::string16 GetDialogLabel() const OVERRIDE; |
75 virtual base::string16 GetDialogTitle() const OVERRIDE; | 82 virtual base::string16 GetDialogTitle() const OVERRIDE; |
76 virtual int GetDialogButtons() const OVERRIDE; | 83 virtual int GetDialogButtons() const OVERRIDE; |
77 virtual int GetDefaultDialogButton() const OVERRIDE; | 84 virtual int GetDefaultDialogButton() const OVERRIDE; |
78 virtual base::string16 GetDialogButtonLabel( | 85 virtual base::string16 GetDialogButtonLabel( |
79 ui::DialogButton button) const OVERRIDE; | 86 ui::DialogButton button) const OVERRIDE; |
80 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 87 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
81 virtual bool OnDialogButtonActivated(ui::DialogButton button) OVERRIDE; | 88 virtual bool OnDialogButtonActivated(ui::DialogButton button) OVERRIDE; |
82 | 89 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 virtual const Widget* GetWidget() const OVERRIDE; | 136 virtual const Widget* GetWidget() const OVERRIDE; |
130 virtual View* GetContentsView() OVERRIDE; | 137 virtual View* GetContentsView() OVERRIDE; |
131 | 138 |
132 private: | 139 private: |
133 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); | 140 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); |
134 }; | 141 }; |
135 | 142 |
136 } // namespace views | 143 } // namespace views |
137 | 144 |
138 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 145 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
OLD | NEW |