| 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_WIDGET_WIDGET_DELEGATE_H_ | 5 #ifndef UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
| 6 #define UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ | 6 #define UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Handles events on Widgets in context-specific ways. | 29 // Handles events on Widgets in context-specific ways. |
| 30 class VIEWS_EXPORT WidgetDelegate { | 30 class VIEWS_EXPORT WidgetDelegate { |
| 31 public: | 31 public: |
| 32 WidgetDelegate(); | 32 WidgetDelegate(); |
| 33 | 33 |
| 34 // Sets the return value of CanActivate(). Default is true. | 34 // Sets the return value of CanActivate(). Default is true. |
| 35 void set_can_activate(bool can_activate) { | 35 void set_can_activate(bool can_activate) { |
| 36 can_activate_ = can_activate; | 36 can_activate_ = can_activate; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void set_top_level(bool is_top_level) { |
| 40 is_top_level_ = is_top_level; |
| 41 } |
| 42 |
| 39 // Called whenever the widget's position changes. | 43 // Called whenever the widget's position changes. |
| 40 virtual void OnWidgetMove(); | 44 virtual void OnWidgetMove(); |
| 41 | 45 |
| 42 // Called with the display changes (color depth or resolution). | 46 // Called with the display changes (color depth or resolution). |
| 43 virtual void OnDisplayChanged(); | 47 virtual void OnDisplayChanged(); |
| 44 | 48 |
| 45 // Called when the work area (the desktop area minus task bars, | 49 // Called when the work area (the desktop area minus task bars, |
| 46 // menu bars, etc.) changes in size. | 50 // menu bars, etc.) changes in size. |
| 47 virtual void OnWorkAreaChanged(); | 51 virtual void OnWorkAreaChanged(); |
| 48 | 52 |
| 49 // Returns the view that should have the focus when the widget is shown. If | 53 // Returns the view that should have the focus when the widget is shown. If |
| 50 // NULL no view is focused. | 54 // NULL no view is focused. |
| 51 virtual View* GetInitiallyFocusedView(); | 55 virtual View* GetInitiallyFocusedView(); |
| 52 | 56 |
| 53 virtual BubbleDialogDelegateView* AsBubbleDialogDelegate(); | 57 virtual BubbleDialogDelegateView* AsBubbleDialogDelegate(); |
| 54 virtual DialogDelegate* AsDialogDelegate(); | 58 virtual DialogDelegate* AsDialogDelegate(); |
| 55 | 59 |
| 56 // Returns true if the window can be resized. | 60 // Returns true if the window can be resized. |
| 57 virtual bool CanResize() const; | 61 virtual bool CanResize() const; |
| 58 | 62 |
| 59 // Returns true if the window can be maximized. | 63 // Returns true if the window can be maximized. |
| 60 virtual bool CanMaximize() const; | 64 virtual bool CanMaximize() const; |
| 61 | 65 |
| 62 // Returns true if the window can be minimized. | 66 // Returns true if the window can be minimized. |
| 63 virtual bool CanMinimize() const; | 67 virtual bool CanMinimize() const; |
| 64 | 68 |
| 65 // Returns true if the window can be activated. | 69 // Returns true if the window can be activated. |
| 66 virtual bool CanActivate() const; | 70 virtual bool CanActivate() const; |
| 67 | 71 |
| 72 virtual bool IsTopLevel() const; |
| 73 |
| 68 // Returns the modal type that applies to the widget. Default is | 74 // Returns the modal type that applies to the widget. Default is |
| 69 // ui::MODAL_TYPE_NONE (not modal). | 75 // ui::MODAL_TYPE_NONE (not modal). |
| 70 virtual ui::ModalType GetModalType() const; | 76 virtual ui::ModalType GetModalType() const; |
| 71 | 77 |
| 72 virtual ui::AXRole GetAccessibleWindowRole() const; | 78 virtual ui::AXRole GetAccessibleWindowRole() const; |
| 73 | 79 |
| 74 // Returns the title to be read with screen readers. | 80 // Returns the title to be read with screen readers. |
| 75 virtual base::string16 GetAccessibleWindowTitle() const; | 81 virtual base::string16 GetAccessibleWindowTitle() const; |
| 76 | 82 |
| 77 // Returns the text to be displayed in the window title. | 83 // Returns the text to be displayed in the window title. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // be cycled through with keyboard focus. | 190 // be cycled through with keyboard focus. |
| 185 virtual void GetAccessiblePanes(std::vector<View*>* panes) {} | 191 virtual void GetAccessiblePanes(std::vector<View*>* panes) {} |
| 186 | 192 |
| 187 protected: | 193 protected: |
| 188 virtual ~WidgetDelegate() {} | 194 virtual ~WidgetDelegate() {} |
| 189 | 195 |
| 190 private: | 196 private: |
| 191 View* default_contents_view_; | 197 View* default_contents_view_; |
| 192 | 198 |
| 193 bool can_activate_; | 199 bool can_activate_; |
| 200 bool is_top_level_; |
| 194 | 201 |
| 195 DISALLOW_COPY_AND_ASSIGN(WidgetDelegate); | 202 DISALLOW_COPY_AND_ASSIGN(WidgetDelegate); |
| 196 }; | 203 }; |
| 197 | 204 |
| 198 // A WidgetDelegate implementation that is-a View. Used to override GetWidget() | 205 // A WidgetDelegate implementation that is-a View. Used to override GetWidget() |
| 199 // to call View's GetWidget() for the common case where a WidgetDelegate | 206 // to call View's GetWidget() for the common case where a WidgetDelegate |
| 200 // implementation is-a View. Note that WidgetDelegateView is not owned by | 207 // implementation is-a View. Note that WidgetDelegateView is not owned by |
| 201 // view's hierarchy and is expected to be deleted on DeleteDelegate call. | 208 // view's hierarchy and is expected to be deleted on DeleteDelegate call. |
| 202 class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { | 209 class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { |
| 203 public: | 210 public: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 215 // View: | 222 // View: |
| 216 const char* GetClassName() const override; | 223 const char* GetClassName() const override; |
| 217 | 224 |
| 218 private: | 225 private: |
| 219 DISALLOW_COPY_AND_ASSIGN(WidgetDelegateView); | 226 DISALLOW_COPY_AND_ASSIGN(WidgetDelegateView); |
| 220 }; | 227 }; |
| 221 | 228 |
| 222 } // namespace views | 229 } // namespace views |
| 223 | 230 |
| 224 #endif // UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ | 231 #endif // UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
| OLD | NEW |