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

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

mercurial