widget/nsIWidgetListener.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/nsIWidgetListener.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,147 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef nsIWidgetListener_h__
     1.9 +#define nsIWidgetListener_h__
    1.10 +
    1.11 +#include <stdint.h>
    1.12 +
    1.13 +#include "mozilla/EventForwards.h"
    1.14 +
    1.15 +class nsView;
    1.16 +class nsIntRegion;
    1.17 +class nsIPresShell;
    1.18 +class nsIWidget;
    1.19 +class nsIXULWindow;
    1.20 +
    1.21 +/**
    1.22 + * sizemode is an adjunct to widget size
    1.23 + */
    1.24 +enum nsSizeMode
    1.25 +{
    1.26 +  nsSizeMode_Normal = 0,
    1.27 +  nsSizeMode_Minimized,
    1.28 +  nsSizeMode_Maximized,
    1.29 +  nsSizeMode_Fullscreen
    1.30 +};
    1.31 +
    1.32 +/**
    1.33 + * different types of (top-level) window z-level positioning
    1.34 + */
    1.35 +enum nsWindowZ
    1.36 +{
    1.37 +  nsWindowZTop = 0,   // on top
    1.38 +  nsWindowZBottom,    // on bottom
    1.39 +  nsWindowZRelative   // just below some specified widget
    1.40 +};
    1.41 +
    1.42 +class nsIWidgetListener
    1.43 +{
    1.44 +public:
    1.45 +
    1.46 +  /**
    1.47 +   * If this listener is for an nsIXULWindow, return it. If this is null, then
    1.48 +   * this is likely a listener for a view, which can be determined using
    1.49 +   * GetView. If both methods return null, this will be an nsWebBrowser.
    1.50 +   */
    1.51 +  virtual nsIXULWindow* GetXULWindow();
    1.52 +
    1.53 +  /**
    1.54 +   * If this listener is for an nsView, return it.
    1.55 +   */
    1.56 +  virtual nsView* GetView();
    1.57 +
    1.58 +  /**
    1.59 +   * Return the presshell for this widget listener.
    1.60 +   */
    1.61 +  virtual nsIPresShell* GetPresShell();
    1.62 +
    1.63 +  /**
    1.64 +   * Called when a window is moved to location (x, y). Returns true if the
    1.65 +   * notification was handled. Coordinates are outer window screen coordinates.
    1.66 +   */
    1.67 +  virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
    1.68 +
    1.69 +  /**
    1.70 +   * Called when a window is resized to (width, height). Returns true if the
    1.71 +   * notification was handled. Coordinates are outer window screen coordinates.
    1.72 +   */
    1.73 +  virtual bool WindowResized(nsIWidget* aWidget,
    1.74 +                             int32_t aWidth, int32_t aHeight);
    1.75 +
    1.76 +  /**
    1.77 +   * Called when the size mode (minimized, maximized, fullscreen) is changed.
    1.78 +   */
    1.79 +  virtual void SizeModeChanged(nsSizeMode aSizeMode);
    1.80 +
    1.81 +  /**
    1.82 +   * Called when the z-order of the window is changed. Returns true if the
    1.83 +   * notification was handled. aPlacement indicates the new z order. If
    1.84 +   * placement is nsWindowZRelative, then aRequestBelow should be the
    1.85 +   * window to place below. On return, aActualBelow will be set to the
    1.86 +   * window actually behind. This generally only applies to Windows.
    1.87 +   */
    1.88 +  virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
    1.89 +                             nsIWidget* aRequestBelow,
    1.90 +                             nsIWidget** aActualBelow);
    1.91 +
    1.92 +  /**
    1.93 +   * Called when the window is activated and focused.
    1.94 +   */
    1.95 +  virtual void WindowActivated();
    1.96 +
    1.97 +  /**
    1.98 +   * Called when the window is deactivated and no longer focused.
    1.99 +   */
   1.100 +  virtual void WindowDeactivated();
   1.101 +
   1.102 +  /**
   1.103 +   * Called when the show/hide toolbar button on the Mac titlebar is pressed.
   1.104 +   */
   1.105 +  virtual void OSToolbarButtonPressed();
   1.106 +
   1.107 +  /**
   1.108 +   * Called when a request is made to close the window. Returns true if the
   1.109 +   * notification was handled. Returns true if the notification was handled.
   1.110 +   */
   1.111 +  virtual bool RequestWindowClose(nsIWidget* aWidget);
   1.112 +
   1.113 +  /*
   1.114 +   * Indicate that a paint is about to occur on this window. This is called
   1.115 +   * at a time when it's OK to change the geometry of this widget or of
   1.116 +   * other widgets. Must be called before every call to PaintWindow.
   1.117 +   */
   1.118 +  virtual void WillPaintWindow(nsIWidget* aWidget);
   1.119 +
   1.120 +  /**
   1.121 +   * Paint the specified region of the window. Returns true if the
   1.122 +   * notification was handled.
   1.123 +   * This is called at a time when it is not OK to change the geometry of
   1.124 +   * this widget or of other widgets.
   1.125 +   */
   1.126 +  virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion);
   1.127 +
   1.128 +  /**
   1.129 +   * Indicates that a paint occurred.
   1.130 +   * This is called at a time when it is OK to change the geometry of
   1.131 +   * this widget or of other widgets.
   1.132 +   * Must be called after every call to PaintWindow.
   1.133 +   */
   1.134 +  virtual void DidPaintWindow();
   1.135 +
   1.136 +  virtual void DidCompositeWindow();
   1.137 +
   1.138 +  /**
   1.139 +   * Request that layout schedules a repaint on the next refresh driver tick.
   1.140 +   */
   1.141 +  virtual void RequestRepaint();
   1.142 +
   1.143 +  /**
   1.144 +   * Handle an event.
   1.145 +   */
   1.146 +  virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent,
   1.147 +                                    bool aUseAttachedEvents);
   1.148 +};
   1.149 +
   1.150 +#endif

mercurial