Bumping manifests a=b2g-bump
[gecko.git] / widget / nsIWidgetListener.h
blob4345b80cb46d23480729a54bc04e8afc5cf3b31f
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
21 enum nsSizeMode
23 nsSizeMode_Normal = 0,
24 nsSizeMode_Minimized,
25 nsSizeMode_Maximized,
26 nsSizeMode_Fullscreen
29 /**
30 * different types of (top-level) window z-level positioning
32 enum nsWindowZ
34 nsWindowZTop = 0, // on top
35 nsWindowZBottom, // on bottom
36 nsWindowZRelative // just below some specified widget
39 class nsIWidgetListener
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.
48 virtual nsIXULWindow* GetXULWindow();
50 /**
51 * If this listener is for an nsView, return it.
53 virtual nsView* GetView();
55 /**
56 * Return the presshell for this widget listener.
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.
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.
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.
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.
85 virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
86 nsIWidget* aRequestBelow,
87 nsIWidget** aActualBelow);
89 /**
90 * Called when the window is activated and focused.
92 virtual void WindowActivated();
94 /**
95 * Called when the window is deactivated and no longer focused.
97 virtual void WindowDeactivated();
99 /**
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();
141 * Handle an event.
143 virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent,
144 bool aUseAttachedEvents);
147 #endif