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__
10 #include "mozilla/EventForwards.h"
19 * sizemode is an adjunct to widget size
23 nsSizeMode_Normal
= 0,
30 * different types of (top-level) window z-level positioning
34 nsWindowZTop
= 0, // on top
35 nsWindowZBottom
, // on bottom
36 nsWindowZRelative
// just below some specified widget
39 class nsIWidgetListener
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.
48 virtual nsIXULWindow
* GetXULWindow();
51 * If this listener is for an nsView, return it.
53 virtual nsView
* GetView();
56 * Return the presshell for this widget listener.
58 virtual nsIPresShell
* GetPresShell();
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.
64 virtual bool WindowMoved(nsIWidget
* aWidget
, int32_t aX
, int32_t aY
);
67 * Called when a window is resized to (width, height). Returns true if the
68 * notification was handled. Coordinates are outer window screen coordinates.
70 virtual bool WindowResized(nsIWidget
* aWidget
,
71 int32_t aWidth
, int32_t aHeight
);
74 * Called when the size mode (minimized, maximized, fullscreen) is changed.
76 virtual void SizeModeChanged(nsSizeMode aSizeMode
);
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.
85 virtual bool ZLevelChanged(bool aImmediate
, nsWindowZ
* aPlacement
,
86 nsIWidget
* aRequestBelow
,
87 nsIWidget
** aActualBelow
);
90 * Called when the window is activated and focused.
92 virtual void WindowActivated();
95 * Called when the window is deactivated and no longer focused.
97 virtual void WindowDeactivated();
100 * Called when the show/hide toolbar button on the Mac titlebar is pressed.
102 virtual void OSToolbarButtonPressed();
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.
108 virtual bool RequestWindowClose(nsIWidget
* aWidget
);
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.
115 virtual void WillPaintWindow(nsIWidget
* aWidget
);
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.
123 virtual bool PaintWindow(nsIWidget
* aWidget
, nsIntRegion aRegion
);
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.
131 virtual void DidPaintWindow();
133 virtual void DidCompositeWindow();
136 * Request that layout schedules a repaint on the next refresh driver tick.
138 virtual void RequestRepaint();
143 virtual nsEventStatus
HandleEvent(mozilla::WidgetGUIEvent
* aEvent
,
144 bool aUseAttachedEvents
);