widget/nsIWidgetListener.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef nsIWidgetListener_h__
     6 #define nsIWidgetListener_h__
     8 #include <stdint.h>
    10 #include "mozilla/EventForwards.h"
    12 class nsView;
    13 class nsIntRegion;
    14 class nsIPresShell;
    15 class nsIWidget;
    16 class nsIXULWindow;
    18 /**
    19  * sizemode is an adjunct to widget size
    20  */
    21 enum nsSizeMode
    22 {
    23   nsSizeMode_Normal = 0,
    24   nsSizeMode_Minimized,
    25   nsSizeMode_Maximized,
    26   nsSizeMode_Fullscreen
    27 };
    29 /**
    30  * different types of (top-level) window z-level positioning
    31  */
    32 enum nsWindowZ
    33 {
    34   nsWindowZTop = 0,   // on top
    35   nsWindowZBottom,    // on bottom
    36   nsWindowZRelative   // just below some specified widget
    37 };
    39 class nsIWidgetListener
    40 {
    41 public:
    43   /**
    44    * If this listener is for an nsIXULWindow, return it. If this is null, then
    45    * this is likely a listener for a view, which can be determined using
    46    * GetView. If both methods return null, this will be an nsWebBrowser.
    47    */
    48   virtual nsIXULWindow* GetXULWindow();
    50   /**
    51    * If this listener is for an nsView, return it.
    52    */
    53   virtual nsView* GetView();
    55   /**
    56    * Return the presshell for this widget listener.
    57    */
    58   virtual nsIPresShell* GetPresShell();
    60   /**
    61    * Called when a window is moved to location (x, y). Returns true if the
    62    * notification was handled. Coordinates are outer window screen coordinates.
    63    */
    64   virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
    66   /**
    67    * Called when a window is resized to (width, height). Returns true if the
    68    * notification was handled. Coordinates are outer window screen coordinates.
    69    */
    70   virtual bool WindowResized(nsIWidget* aWidget,
    71                              int32_t aWidth, int32_t aHeight);
    73   /**
    74    * Called when the size mode (minimized, maximized, fullscreen) is changed.
    75    */
    76   virtual void SizeModeChanged(nsSizeMode aSizeMode);
    78   /**
    79    * Called when the z-order of the window is changed. Returns true if the
    80    * notification was handled. aPlacement indicates the new z order. If
    81    * placement is nsWindowZRelative, then aRequestBelow should be the
    82    * window to place below. On return, aActualBelow will be set to the
    83    * window actually behind. This generally only applies to Windows.
    84    */
    85   virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
    86                              nsIWidget* aRequestBelow,
    87                              nsIWidget** aActualBelow);
    89   /**
    90    * Called when the window is activated and focused.
    91    */
    92   virtual void WindowActivated();
    94   /**
    95    * Called when the window is deactivated and no longer focused.
    96    */
    97   virtual void WindowDeactivated();
    99   /**
   100    * Called when the show/hide toolbar button on the Mac titlebar is pressed.
   101    */
   102   virtual void OSToolbarButtonPressed();
   104   /**
   105    * Called when a request is made to close the window. Returns true if the
   106    * notification was handled. Returns true if the notification was handled.
   107    */
   108   virtual bool RequestWindowClose(nsIWidget* aWidget);
   110   /*
   111    * Indicate that a paint is about to occur on this window. This is called
   112    * at a time when it's OK to change the geometry of this widget or of
   113    * other widgets. Must be called before every call to PaintWindow.
   114    */
   115   virtual void WillPaintWindow(nsIWidget* aWidget);
   117   /**
   118    * Paint the specified region of the window. Returns true if the
   119    * notification was handled.
   120    * This is called at a time when it is not OK to change the geometry of
   121    * this widget or of other widgets.
   122    */
   123   virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion);
   125   /**
   126    * Indicates that a paint occurred.
   127    * This is called at a time when it is OK to change the geometry of
   128    * this widget or of other widgets.
   129    * Must be called after every call to PaintWindow.
   130    */
   131   virtual void DidPaintWindow();
   133   virtual void DidCompositeWindow();
   135   /**
   136    * Request that layout schedules a repaint on the next refresh driver tick.
   137    */
   138   virtual void RequestRepaint();
   140   /**
   141    * Handle an event.
   142    */
   143   virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent,
   144                                     bool aUseAttachedEvents);
   145 };
   147 #endif

mercurial