michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsIWidgetListener_h__ michael@0: #define nsIWidgetListener_h__ michael@0: michael@0: #include michael@0: michael@0: #include "mozilla/EventForwards.h" michael@0: michael@0: class nsView; michael@0: class nsIntRegion; michael@0: class nsIPresShell; michael@0: class nsIWidget; michael@0: class nsIXULWindow; michael@0: michael@0: /** michael@0: * sizemode is an adjunct to widget size michael@0: */ michael@0: enum nsSizeMode michael@0: { michael@0: nsSizeMode_Normal = 0, michael@0: nsSizeMode_Minimized, michael@0: nsSizeMode_Maximized, michael@0: nsSizeMode_Fullscreen michael@0: }; michael@0: michael@0: /** michael@0: * different types of (top-level) window z-level positioning michael@0: */ michael@0: enum nsWindowZ michael@0: { michael@0: nsWindowZTop = 0, // on top michael@0: nsWindowZBottom, // on bottom michael@0: nsWindowZRelative // just below some specified widget michael@0: }; michael@0: michael@0: class nsIWidgetListener michael@0: { michael@0: public: michael@0: michael@0: /** michael@0: * If this listener is for an nsIXULWindow, return it. If this is null, then michael@0: * this is likely a listener for a view, which can be determined using michael@0: * GetView. If both methods return null, this will be an nsWebBrowser. michael@0: */ michael@0: virtual nsIXULWindow* GetXULWindow(); michael@0: michael@0: /** michael@0: * If this listener is for an nsView, return it. michael@0: */ michael@0: virtual nsView* GetView(); michael@0: michael@0: /** michael@0: * Return the presshell for this widget listener. michael@0: */ michael@0: virtual nsIPresShell* GetPresShell(); michael@0: michael@0: /** michael@0: * Called when a window is moved to location (x, y). Returns true if the michael@0: * notification was handled. Coordinates are outer window screen coordinates. michael@0: */ michael@0: virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY); michael@0: michael@0: /** michael@0: * Called when a window is resized to (width, height). Returns true if the michael@0: * notification was handled. Coordinates are outer window screen coordinates. michael@0: */ michael@0: virtual bool WindowResized(nsIWidget* aWidget, michael@0: int32_t aWidth, int32_t aHeight); michael@0: michael@0: /** michael@0: * Called when the size mode (minimized, maximized, fullscreen) is changed. michael@0: */ michael@0: virtual void SizeModeChanged(nsSizeMode aSizeMode); michael@0: michael@0: /** michael@0: * Called when the z-order of the window is changed. Returns true if the michael@0: * notification was handled. aPlacement indicates the new z order. If michael@0: * placement is nsWindowZRelative, then aRequestBelow should be the michael@0: * window to place below. On return, aActualBelow will be set to the michael@0: * window actually behind. This generally only applies to Windows. michael@0: */ michael@0: virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement, michael@0: nsIWidget* aRequestBelow, michael@0: nsIWidget** aActualBelow); michael@0: michael@0: /** michael@0: * Called when the window is activated and focused. michael@0: */ michael@0: virtual void WindowActivated(); michael@0: michael@0: /** michael@0: * Called when the window is deactivated and no longer focused. michael@0: */ michael@0: virtual void WindowDeactivated(); michael@0: michael@0: /** michael@0: * Called when the show/hide toolbar button on the Mac titlebar is pressed. michael@0: */ michael@0: virtual void OSToolbarButtonPressed(); michael@0: michael@0: /** michael@0: * Called when a request is made to close the window. Returns true if the michael@0: * notification was handled. Returns true if the notification was handled. michael@0: */ michael@0: virtual bool RequestWindowClose(nsIWidget* aWidget); michael@0: michael@0: /* michael@0: * Indicate that a paint is about to occur on this window. This is called michael@0: * at a time when it's OK to change the geometry of this widget or of michael@0: * other widgets. Must be called before every call to PaintWindow. michael@0: */ michael@0: virtual void WillPaintWindow(nsIWidget* aWidget); michael@0: michael@0: /** michael@0: * Paint the specified region of the window. Returns true if the michael@0: * notification was handled. michael@0: * This is called at a time when it is not OK to change the geometry of michael@0: * this widget or of other widgets. michael@0: */ michael@0: virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion); michael@0: michael@0: /** michael@0: * Indicates that a paint occurred. michael@0: * This is called at a time when it is OK to change the geometry of michael@0: * this widget or of other widgets. michael@0: * Must be called after every call to PaintWindow. michael@0: */ michael@0: virtual void DidPaintWindow(); michael@0: michael@0: virtual void DidCompositeWindow(); michael@0: michael@0: /** michael@0: * Request that layout schedules a repaint on the next refresh driver tick. michael@0: */ michael@0: virtual void RequestRepaint(); michael@0: michael@0: /** michael@0: * Handle an event. michael@0: */ michael@0: virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent, michael@0: bool aUseAttachedEvents); michael@0: }; michael@0: michael@0: #endif