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_OBSERVER_H_ | 5 #ifndef UI_VIEWS_WIDGET_WIDGET_OBSERVER_H_ |
6 #define UI_VIEWS_WIDGET_WIDGET_OBSERVER_H_ | 6 #define UI_VIEWS_WIDGET_WIDGET_OBSERVER_H_ |
7 | 7 |
8 #include "ui/views/views_export.h" | 8 #include "ui/views/views_export.h" |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
11 class Rect; | 11 class Rect; |
12 } | 12 } |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 class Widget; | 16 class Widget; |
17 | 17 |
18 // Observers can listen to various events on the Widgets. | 18 // Observers can listen to various events on the Widgets. |
19 class VIEWS_EXPORT WidgetObserver { | 19 class VIEWS_EXPORT WidgetObserver { |
20 public: | 20 public: |
21 // The closing notification is sent immediately in response to (i.e. in the | 21 // The closing notification is sent immediately in response to (i.e. in the |
22 // same call stack as) a request to close the Widget (via Close() or | 22 // same call stack as) a request to close the Widget (via Close() or |
23 // CloseNow()). | 23 // CloseNow()). |
24 virtual void OnWidgetClosing(Widget* widget) {} | 24 virtual void OnWidgetClosing(Widget* widget) {} |
25 | 25 |
| 26 // Invoked after notification is received from the event loop that the native |
| 27 // widget has been created. |
| 28 virtual void OnWidgetCreated(Widget* widget) {} |
| 29 |
26 // The destroying event occurs immediately before the widget is destroyed. | 30 // The destroying event occurs immediately before the widget is destroyed. |
27 // This typically occurs asynchronously with respect the the close request, as | 31 // This typically occurs asynchronously with respect the the close request, as |
28 // a result of a later invocation from the event loop. | 32 // a result of a later invocation from the event loop. |
29 virtual void OnWidgetDestroying(Widget* widget) {} | 33 virtual void OnWidgetDestroying(Widget* widget) {} |
30 | 34 |
| 35 // Invoked after notification is received from the event loop that the native |
| 36 // widget has been destroyed. |
| 37 virtual void OnWidgetDestroyed(Widget* widget) {} |
| 38 |
31 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {} | 39 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {} |
32 | 40 |
33 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {} | 41 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {} |
34 | 42 |
35 virtual void OnWidgetBoundsChanged(Widget* widget, | 43 virtual void OnWidgetBoundsChanged(Widget* widget, |
36 const gfx::Rect& new_bounds) {} | 44 const gfx::Rect& new_bounds) {} |
37 | 45 |
38 protected: | 46 protected: |
39 virtual ~WidgetObserver() {} | 47 virtual ~WidgetObserver() {} |
40 }; | 48 }; |
41 | 49 |
42 } // namespace views | 50 } // namespace views |
43 | 51 |
44 #endif // UI_VIEWS_WIDGET_WIDGET_OBSERVER_H_ | 52 #endif // UI_VIEWS_WIDGET_WIDGET_OBSERVER_H_ |
OLD | NEW |