Chromium Code Reviews| 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/string16.h" | 9 #include "base/string16.h" |
| 10 #include "ui/base/accessibility/accessibility_types.h" | 10 #include "ui/base/accessibility/accessibility_types.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 // DialogDelegate | 21 // DialogDelegate |
| 22 // | 22 // |
| 23 // DialogDelegate is an interface implemented by objects that wish to show a | 23 // DialogDelegate is an interface implemented by objects that wish to show a |
| 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 WidgetDelegate { | 29 class VIEWS_EXPORT DialogDelegate : public WidgetDelegate { |
| 30 public: | 30 public: |
| 31 // Returns whether to use the new dialog style. | |
| 32 static bool UseNewStyle(); | |
|
sky
2012/12/19 15:55:54
constructor/destructor before other methods.
msw
2012/12/19 17:07:33
Done.
| |
| 33 | |
| 31 virtual DialogDelegate* AsDialogDelegate() OVERRIDE; | 34 virtual DialogDelegate* AsDialogDelegate() OVERRIDE; |
| 32 | 35 |
| 33 virtual ~DialogDelegate(); | 36 virtual ~DialogDelegate(); |
| 34 | 37 |
| 35 // Returns a mask specifying which of the available DialogButtons are visible | 38 // Returns a mask specifying which of the available DialogButtons are visible |
| 36 // for the dialog. Note: If an OK button is provided, you should provide a | 39 // for the dialog. Note: If an OK button is provided, you should provide a |
| 37 // CANCEL button. A dialog box with just an OK button is frowned upon and | 40 // CANCEL button. A dialog box with just an OK button is frowned upon and |
| 38 // considered a very special case, so if you're planning on including one, | 41 // considered a very special case, so if you're planning on including one, |
| 39 // you should reconsider, or beng says there will be stabbings. | 42 // you should reconsider, or beng says there will be stabbings. |
| 40 // | 43 // |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 51 | 54 |
| 52 // Returns the label of the specified dialog button. | 55 // Returns the label of the specified dialog button. |
| 53 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const; | 56 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const; |
| 54 | 57 |
| 55 // Returns whether the specified dialog button is enabled. | 58 // Returns whether the specified dialog button is enabled. |
| 56 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const; | 59 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const; |
| 57 | 60 |
| 58 // Returns whether the specified dialog button is visible. | 61 // Returns whether the specified dialog button is visible. |
| 59 virtual bool IsDialogButtonVisible(ui::DialogButton button) const; | 62 virtual bool IsDialogButtonVisible(ui::DialogButton button) const; |
| 60 | 63 |
| 61 // Returns whether to use chrome style for the button strip (like WebUI). If | |
| 62 // false, native style padding is used. | |
| 63 virtual bool UseChromeStyle() const; | |
| 64 | |
| 65 // Returns whether accelerators are enabled on the button. This is invoked | 64 // Returns whether accelerators are enabled on the button. This is invoked |
| 66 // when an accelerator is pressed, not at construction time. This | 65 // when an accelerator is pressed, not at construction time. This |
| 67 // returns true. | 66 // returns true. |
| 68 virtual bool AreAcceleratorsEnabled(ui::DialogButton button); | 67 virtual bool AreAcceleratorsEnabled(ui::DialogButton button); |
| 69 | 68 |
| 70 // Override this function if with a view which will be shown in the same | 69 // Override this function if with a view which will be shown in the same |
| 71 // row as the OK and CANCEL buttons but flush to the left and extending | 70 // row as the OK and CANCEL buttons but flush to the left and extending |
| 72 // up to the buttons. | 71 // up to the buttons. |
| 73 virtual View* GetExtraView(); | 72 virtual View* GetExtraView(); |
| 74 | 73 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 91 // true if the window can be closed after it returns, or false if it must | 90 // true if the window can be closed after it returns, or false if it must |
| 92 // remain open. If |window_closing| is true, it means that this handler is | 91 // remain open. If |window_closing| is true, it means that this handler is |
| 93 // being called because the window is being closed (e.g. by Window::Close) | 92 // being called because the window is being closed (e.g. by Window::Close) |
| 94 // and there is no Cancel handler, so Accept is being called instead. | 93 // and there is no Cancel handler, so Accept is being called instead. |
| 95 virtual bool Accept(bool window_closing); | 94 virtual bool Accept(bool window_closing); |
| 96 virtual bool Accept(); | 95 virtual bool Accept(); |
| 97 | 96 |
| 98 // Overridden from WindowDelegate: | 97 // Overridden from WindowDelegate: |
| 99 virtual View* GetInitiallyFocusedView() OVERRIDE; | 98 virtual View* GetInitiallyFocusedView() OVERRIDE; |
| 100 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; | 99 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; |
| 100 virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; | |
| 101 | 101 |
| 102 // Called when the window has been closed. | 102 // Called when the window has been closed. |
| 103 virtual void OnClose() {} | 103 virtual void OnClose() {} |
| 104 | 104 |
| 105 // A helper for accessing the DialogClientView object contained by this | 105 // A helper for accessing the DialogClientView object contained by this |
| 106 // delegate's Window. | 106 // delegate's Window. |
| 107 const DialogClientView* GetDialogClientView() const; | 107 const DialogClientView* GetDialogClientView() const; |
| 108 DialogClientView* GetDialogClientView(); | 108 DialogClientView* GetDialogClientView(); |
| 109 | 109 |
| 110 protected: | 110 protected: |
| 111 // Overridden from WindowDelegate: | 111 // Overridden from WindowDelegate: |
| 112 virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const OVERRIDE; | 112 virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const OVERRIDE; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 // A DialogDelegate implementation that is-a View. Used to override GetWidget() | 115 // A DialogDelegate implementation that is-a View. Used to override GetWidget() |
| 116 // to call View's GetWidget() for the common case where a DialogDelegate | 116 // to call View's GetWidget() for the common case where a DialogDelegate |
| 117 // implementation is-a View. | 117 // implementation is-a View. |
| 118 class VIEWS_EXPORT DialogDelegateView : public DialogDelegate, | 118 class VIEWS_EXPORT DialogDelegateView : public DialogDelegate, |
| 119 public View { | 119 public View { |
| 120 public: | 120 public: |
| 121 DialogDelegateView(); | 121 DialogDelegateView(); |
| 122 virtual ~DialogDelegateView(); | 122 virtual ~DialogDelegateView(); |
| 123 | 123 |
| 124 // Overridden from DialogDelegate: | 124 // Overridden from DialogDelegate: |
| 125 virtual Widget* GetWidget() OVERRIDE; | 125 virtual Widget* GetWidget() OVERRIDE; |
| 126 virtual const Widget* GetWidget() const OVERRIDE; | 126 virtual const Widget* GetWidget() const OVERRIDE; |
| 127 virtual View* GetContentsView() OVERRIDE; | |
| 127 | 128 |
| 128 private: | 129 private: |
| 129 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); | 130 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 } // namespace views | 133 } // namespace views |
| 133 | 134 |
| 134 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 135 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
| OLD | NEW |