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