Bug 779997 - Import SoundTouch Library in the tree. r=
[gecko.git] / widget / nsIWidgetListener.h
blob8a585bd5ba9bae4c22a42e1b6e3200536286bd78
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is mozila.org code.
16 * The Initial Developer of the Original Code is Mozilla Foundation.
17 * Portions created by the Initial Developer are Copyright (C) 2011
18 * the Initial Developer. All Rights Reserved.
20 * Contributor(s):
22 * Alternatively, the contents of this file may be used under the terms of
23 * either the GNU General Public License Version 2 or later (the "GPL"), or
24 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
25 * in which case the provisions of the GPL or the LGPL are applicable instead
26 * of those above. If you wish to allow use of your version of this file only
27 * under the terms of either the GPL or the LGPL, and not to allow others to
28 * use your version of this file under the terms of the MPL, indicate your
29 * decision by deleting the provisions above and replace them with the notice
30 * and other provisions required by the GPL or the LGPL. If you do not delete
31 * the provisions above, a recipient may use your version of this file under
32 * the terms of any one of the MPL, the GPL or the LGPL.
34 * ***** END LICENSE BLOCK ***** */
36 #ifndef nsIWidgetListener_h__
37 #define nsIWidgetListener_h__
39 #include "nscore.h"
40 #include "nsGUIEvent.h"
41 #include "nsIXULWindow.h"
43 class nsIView;
44 class nsIPresShell;
46 class nsIWidgetListener
48 public:
50 /**
51 * If this listener is for an nsIXULWindow, return it. If this is null, then
52 * this is likely a listener for a view, which can be determined using
53 * GetView. If both methods return null, this will be an nsWebBrowser.
55 virtual nsIXULWindow* GetXULWindow() { return nullptr; }
57 /**
58 * If this listener is for an nsIView, return it.
60 virtual nsIView* GetView() { return nullptr; }
62 /**
63 * Return the presshell for this widget listener.
65 virtual nsIPresShell* GetPresShell() { return nullptr; }
67 /**
68 * Called when a window is moved to location (x, y). Returns true if the
69 * notification was handled. Coordinates are outer window screen coordinates.
71 virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY) { return false; }
73 /**
74 * Called when a window is resized to (width, height). Returns true if the
75 * notification was handled. Coordinates are outer window screen coordinates.
77 virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight) { return false; }
79 /**
80 * Called when the size mode (minimized, maximized, fullscreen) is changed.
82 virtual void SizeModeChanged(nsSizeMode sizeMode) { }
84 /**
85 * Called when the z-order of the window is changed. Returns true if the
86 * notification was handled. aPlacement indicates the new z order. If
87 * placement is nsWindowZRelative, then aRequestBelow should be the
88 * window to place below. On return, aActualBelow will be set to the
89 * window actually behind. This generally only applies to Windows.
91 virtual bool ZLevelChanged(bool aImmediate, nsWindowZ *aPlacement,
92 nsIWidget* aRequestBelow, nsIWidget** aActualBelow) { return false; }
94 /**
95 * Called when the window is activated and focused.
97 virtual void WindowActivated() { }
99 /**
100 * Called when the window is deactivated and no longer focused.
102 virtual void WindowDeactivated() { }
105 * Called when the show/hide toolbar button on the Mac titlebar is pressed.
107 virtual void OSToolbarButtonPressed() { }
110 * Called when a request is made to close the window. Returns true if the
111 * notification was handled. Returns true if the notification was handled.
113 virtual bool RequestWindowClose(nsIWidget* aWidget) { return false; }
116 * Indicate that a paint is about to occur on this window.
118 virtual void WillPaintWindow(nsIWidget* aWidget, bool aWillSendDidPaint) { }
121 * Paint the specified region of the window. Returns true if the
122 * notification was handled.
124 enum {
125 SENT_WILL_PAINT = 1 << 0, /* WillPaintWindow has already been called */
126 WILL_SEND_DID_PAINT = 1 << 1, /* A call to DidPaintWindow will be made afterwards. */
127 PAINT_IS_ALTERNATE = 1 << 2 /* We are painting something other than the normal widget */
129 virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags) { return false; }
132 * On some platforms, indicates that a paint occurred.
134 virtual void DidPaintWindow() { }
137 * Handle an event.
139 virtual nsEventStatus HandleEvent(nsGUIEvent* event, bool useAttachedEvents)
141 return nsEventStatus_eIgnore;
145 #endif