| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_WIDGET_WIDGET_DELEGATE_H_ | 5 #ifndef VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
| 6 #define VIEWS_WIDGET_WIDGET_DELEGATE_H_ | 6 #define VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "ui/base/accessibility/accessibility_types.h" | 12 #include "ui/base/accessibility/accessibility_types.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Rect; | 17 class Rect; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 class ClientView; | 21 class ClientView; |
| 22 class DialogDelegate; | 22 class DialogDelegate; |
| 23 class NonClientFrameView; | 23 class NonClientFrameView; |
| 24 class View; | 24 class View; |
| 25 class Widget; |
| 25 class Window; | 26 class Window; |
| 26 | 27 |
| 27 // WidgetDelegate interface | 28 // WidgetDelegate interface |
| 28 // Handles events on Widgets in context-specific ways. | 29 // Handles events on Widgets in context-specific ways. |
| 29 class WidgetDelegate { | 30 class WidgetDelegate { |
| 30 public: | 31 public: |
| 31 WidgetDelegate(); | 32 WidgetDelegate(); |
| 32 | 33 |
| 33 // Called whenever the widget is activated or deactivated. | 34 // Called whenever the widget is activated or deactivated. |
| 34 // TODO(beng): This should be consolidated with | 35 // TODO(beng): This should be consolidated with |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 virtual void OnWindowActivationChanged(bool active) {} | 131 virtual void OnWindowActivationChanged(bool active) {} |
| 131 | 132 |
| 132 // Called when the user begins/ends to change the bounds of the window. | 133 // Called when the user begins/ends to change the bounds of the window. |
| 133 virtual void OnWindowBeginUserBoundsChange() {} | 134 virtual void OnWindowBeginUserBoundsChange() {} |
| 134 virtual void OnWindowEndUserBoundsChange() {} | 135 virtual void OnWindowEndUserBoundsChange() {} |
| 135 | 136 |
| 136 // Returns the View that is contained within this Window. | 137 // Returns the View that is contained within this Window. |
| 137 virtual View* GetContentsView(); | 138 virtual View* GetContentsView(); |
| 138 | 139 |
| 139 // Called by the Window to create the Client View used to host the contents | 140 // Called by the Window to create the Client View used to host the contents |
| 140 // of the window. | 141 // of the widget. |
| 141 virtual ClientView* CreateClientView(Window* window); | 142 virtual ClientView* CreateClientView(Widget* widget); |
| 142 | 143 |
| 143 // Called by the Widget to create the NonClient Frame View for this widget. | 144 // Called by the Widget to create the NonClient Frame View for this widget. |
| 144 // Return NULL to use the default one. | 145 // Return NULL to use the default one. |
| 145 virtual NonClientFrameView* CreateNonClientFrameView(); | 146 virtual NonClientFrameView* CreateNonClientFrameView(); |
| 146 | 147 |
| 147 // Returns true if the window can be notified with the work area change. | 148 // Returns true if the window can be notified with the work area change. |
| 148 // Otherwise, the work area change for the top window will be processed by | 149 // Otherwise, the work area change for the top window will be processed by |
| 149 // the default window manager. In some cases, like panel, we would like to | 150 // the default window manager. In some cases, like panel, we would like to |
| 150 // manage the positions by ourselves. | 151 // manage the positions by ourselves. |
| 151 virtual bool WillProcessWorkAreaChange() const; | 152 virtual bool WillProcessWorkAreaChange() const; |
| 152 | 153 |
| 153 Window* window() const { return window_; } | 154 Window* window() const { return window_; } |
| 154 | 155 |
| 155 protected: | 156 protected: |
| 156 virtual ~WidgetDelegate() {} | 157 virtual ~WidgetDelegate() {} |
| 157 | 158 |
| 158 private: | 159 private: |
| 159 friend class Window; | 160 friend class Window; |
| 160 // The Window this delegate is bound to. Weak reference. | 161 // The Window this delegate is bound to. Weak reference. |
| 161 Window* window_; | 162 Window* window_; |
| 162 }; | 163 }; |
| 163 | 164 |
| 164 } // namespace views | 165 } // namespace views |
| 165 | 166 |
| 166 #endif // VIEWS_WIDGET_WIDGET_DELEGATE_H_ | 167 #endif // VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
| 167 | 168 |
| OLD | NEW |