LCOV - code coverage report
Current view: top level - widget - nsIWidgetListener.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 1 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       4             : 
       5             : #ifndef nsIWidgetListener_h__
       6             : #define nsIWidgetListener_h__
       7             : 
       8             : #include <stdint.h>
       9             : 
      10             : #include "mozilla/EventForwards.h"
      11             : #include "mozilla/TimeStamp.h"
      12             : 
      13             : #include "nsRegionFwd.h"
      14             : #include "Units.h"
      15             : 
      16             : class nsView;
      17             : class nsIPresShell;
      18             : class nsIWidget;
      19             : class nsIXULWindow;
      20             : 
      21             : /**
      22             :  * sizemode is an adjunct to widget size
      23             :  */
      24             : enum nsSizeMode
      25             : {
      26             :   nsSizeMode_Normal = 0,
      27             :   nsSizeMode_Minimized,
      28             :   nsSizeMode_Maximized,
      29             :   nsSizeMode_Fullscreen,
      30             :   nsSizeMode_Invalid
      31             : };
      32             : 
      33             : /**
      34             :  * different types of (top-level) window z-level positioning
      35             :  */
      36             : enum nsWindowZ
      37             : {
      38             :   nsWindowZTop = 0,   // on top
      39             :   nsWindowZBottom,    // on bottom
      40             :   nsWindowZRelative   // just below some specified widget
      41             : };
      42             : 
      43          81 : class nsIWidgetListener
      44             : {
      45             : public:
      46             : 
      47             :   /**
      48             :    * If this listener is for an nsIXULWindow, return it. If this is null, then
      49             :    * this is likely a listener for a view, which can be determined using
      50             :    * GetView. If both methods return null, this will be an nsWebBrowser.
      51             :    */
      52             :   virtual nsIXULWindow* GetXULWindow();
      53             : 
      54             :   /**
      55             :    * If this listener is for an nsView, return it.
      56             :    */
      57             :   virtual nsView* GetView();
      58             : 
      59             :   /**
      60             :    * Return the presshell for this widget listener.
      61             :    */
      62             :   virtual nsIPresShell* GetPresShell();
      63             : 
      64             :   /**
      65             :    * Called when a window is moved to location (x, y). Returns true if the
      66             :    * notification was handled. Coordinates are outer window screen coordinates.
      67             :    */
      68             :   virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
      69             : 
      70             :   /**
      71             :    * Called when a window is resized to (width, height). Returns true if the
      72             :    * notification was handled. Coordinates are outer window screen coordinates.
      73             :    */
      74             :   virtual bool WindowResized(nsIWidget* aWidget,
      75             :                              int32_t aWidth, int32_t aHeight);
      76             : 
      77             :   /**
      78             :    * Called when the size mode (minimized, maximized, fullscreen) is changed.
      79             :    */
      80             :   virtual void SizeModeChanged(nsSizeMode aSizeMode);
      81             : 
      82             :   /**
      83             :    * Called when the DPI (device resolution scaling factor) is changed,
      84             :    * such that UI elements may need to be rescaled.
      85             :    */
      86             :   virtual void UIResolutionChanged();
      87             : 
      88             :   /**
      89             :    * Called when the z-order of the window is changed. Returns true if the
      90             :    * notification was handled. aPlacement indicates the new z order. If
      91             :    * placement is nsWindowZRelative, then aRequestBelow should be the
      92             :    * window to place below. On return, aActualBelow will be set to the
      93             :    * window actually behind. This generally only applies to Windows.
      94             :    */
      95             :   virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
      96             :                              nsIWidget* aRequestBelow,
      97             :                              nsIWidget** aActualBelow);
      98             : 
      99             :   /**
     100             :    * Called when the window entered or left the fullscreen state.
     101             :    */
     102             :   virtual void FullscreenChanged(bool aInFullscreen);
     103             : 
     104             :   /**
     105             :    * Called when the occlusion state is changed.
     106             :    */
     107             :   virtual void OcclusionStateChanged(bool aIsFullyOccluded);
     108             : 
     109             :   /**
     110             :    * Called when the window is activated and focused.
     111             :    */
     112             :   virtual void WindowActivated();
     113             : 
     114             :   /**
     115             :    * Called when the window is deactivated and no longer focused.
     116             :    */
     117             :   virtual void WindowDeactivated();
     118             : 
     119             :   /**
     120             :    * Called when the show/hide toolbar button on the Mac titlebar is pressed.
     121             :    */
     122             :   virtual void OSToolbarButtonPressed();
     123             : 
     124             :   /**
     125             :    * Called when a request is made to close the window. Returns true if the
     126             :    * notification was handled. Returns true if the notification was handled.
     127             :    */
     128             :   virtual bool RequestWindowClose(nsIWidget* aWidget);
     129             : 
     130             :   /*
     131             :    * Indicate that a paint is about to occur on this window. This is called
     132             :    * at a time when it's OK to change the geometry of this widget or of
     133             :    * other widgets. Must be called before every call to PaintWindow.
     134             :    */
     135             :   virtual void WillPaintWindow(nsIWidget* aWidget);
     136             : 
     137             :   /**
     138             :    * Paint the specified region of the window. Returns true if the
     139             :    * notification was handled.
     140             :    * This is called at a time when it is not OK to change the geometry of
     141             :    * this widget or of other widgets.
     142             :    */
     143             :   virtual bool PaintWindow(nsIWidget* aWidget,
     144             :                            mozilla::LayoutDeviceIntRegion aRegion);
     145             : 
     146             :   /**
     147             :    * Indicates that a paint occurred.
     148             :    * This is called at a time when it is OK to change the geometry of
     149             :    * this widget or of other widgets.
     150             :    * Must be called after every call to PaintWindow.
     151             :    */
     152             :   virtual void DidPaintWindow();
     153             : 
     154             :   virtual void DidCompositeWindow(uint64_t aTransactionId,
     155             :                                   const mozilla::TimeStamp& aCompositeStart,
     156             :                                   const mozilla::TimeStamp& aCompositeEnd);
     157             : 
     158             :   /**
     159             :    * Request that layout schedules a repaint on the next refresh driver tick.
     160             :    */
     161             :   virtual void RequestRepaint();
     162             : 
     163             :   /**
     164             :    * Handle an event.
     165             :    */
     166             :   virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent,
     167             :                                     bool aUseAttachedEvents);
     168             : };
     169             : 
     170             : #endif

Generated by: LCOV version 1.13