2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2003-10-07 05:19:16 +04:00
|
|
|
|
1999-06-16 08:23:37 +04:00
|
|
|
#include "nsISupports.idl"
|
2001-10-31 01:07:28 +03:00
|
|
|
#include "nsISimpleEnumerator.idl"
|
1999-06-16 08:23:37 +04:00
|
|
|
|
|
|
|
%{C++
|
|
|
|
#define NS_WINDOWMEDIATOR_CID \
|
2013-05-14 19:34:12 +04:00
|
|
|
{ 0x79a2b7cc, 0xf05b, 0x4605, \
|
|
|
|
{ 0xbf, 0xa0, 0xfa, 0xc5, 0x4f, 0x27, 0xee, 0xc8 } }
|
2001-10-13 01:03:40 +04:00
|
|
|
|
|
|
|
#define NS_WINDOWMEDIATOR_CONTRACTID \
|
|
|
|
"@mozilla.org/appshell/window-mediator;1"
|
1999-06-16 08:23:37 +04:00
|
|
|
%}
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
interface mozIDOMWindow;
|
|
|
|
interface mozIDOMWindowProxy;
|
2000-02-29 03:20:55 +03:00
|
|
|
interface nsIXULWindow;
|
2000-04-02 02:07:41 +04:00
|
|
|
interface nsIWidget;
|
2002-06-27 02:34:09 +04:00
|
|
|
interface nsIWindowMediatorListener;
|
1999-06-16 08:23:37 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
[scriptable, uuid(df0da056-357d-427f-bafd-e6cbf19c9381)]
|
2001-09-25 02:31:49 +04:00
|
|
|
interface nsIWindowMediator: nsISupports
|
1999-06-16 08:23:37 +04:00
|
|
|
{
|
2003-10-07 05:19:16 +04:00
|
|
|
/** Return an enumerator which iterates over all windows of type aWindowType
|
|
|
|
* from the oldest window to the youngest.
|
|
|
|
* @param aWindowType the returned enumerator will enumerate only
|
|
|
|
* windows of this type. ("type" is the
|
|
|
|
* |windowtype| attribute of the XML <window> element.)
|
|
|
|
* If null, all windows will be enumerated.
|
2013-09-14 01:29:51 +04:00
|
|
|
* @return an enumerator of nsIDOMWindows. Note that windows close
|
|
|
|
* asynchronously in many cases, so windows returned from this
|
|
|
|
* enumerator can have .closed set to true. Caveat enumerator!
|
2003-10-07 05:19:16 +04:00
|
|
|
*/
|
|
|
|
nsISimpleEnumerator getEnumerator(in wstring aWindowType);
|
|
|
|
|
|
|
|
/** Identical to getEnumerator except:
|
|
|
|
* @return an enumerator of nsIXULWindows
|
|
|
|
*/
|
|
|
|
nsISimpleEnumerator getXULWindowEnumerator(in wstring aWindowType);
|
|
|
|
|
|
|
|
/** Return an enumerator which iterates over all windows of type aWindowType
|
|
|
|
* in their z (front-to-back) order. Note this interface makes
|
|
|
|
* no requirement that a window couldn't be revisited if windows
|
|
|
|
* are re-ordered while z-order enumerators are active.
|
|
|
|
* @param aWindowType the returned enumerator will enumerate only
|
|
|
|
* windows of this type. ("type" is the
|
|
|
|
* |windowtype| attribute of the XML <window> element.)
|
|
|
|
* If null, all windows will be enumerated.
|
|
|
|
* @param aFrontToBack if true, the enumerator enumerates windows in order
|
|
|
|
* from front to back. back to front if false.
|
|
|
|
* @return an enumerator of nsIXULWindows
|
|
|
|
*/
|
|
|
|
nsISimpleEnumerator getZOrderXULWindowEnumerator(in wstring aWindowType,
|
|
|
|
in boolean aFrontToBack);
|
|
|
|
|
|
|
|
/** This is a shortcut for simply fetching the first window in
|
|
|
|
* front to back order.
|
|
|
|
* @param aWindowType return the topmost window of this type.
|
|
|
|
* ("type" is the |windowtype| attribute of
|
|
|
|
* the XML <window> element.)
|
|
|
|
* If null, return the topmost window of any type.
|
|
|
|
* @return the topmost window
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
mozIDOMWindowProxy getMostRecentWindow(in wstring aWindowType);
|
2003-10-07 05:19:16 +04:00
|
|
|
|
2018-12-15 01:53:21 +03:00
|
|
|
/** This is a shortcut for getMostRecentWindow('navigator:browser'), but
|
|
|
|
* it also tries 'navigator:geckoview' if that fails.
|
|
|
|
*
|
|
|
|
* @return the topmost browser window
|
|
|
|
*/
|
|
|
|
mozIDOMWindowProxy getMostRecentBrowserWindow();
|
|
|
|
|
2018-03-20 12:27:00 +03:00
|
|
|
/**
|
|
|
|
* Same as getMostRecentWindow, but ignores private browsing
|
|
|
|
* windows.
|
|
|
|
*/
|
|
|
|
mozIDOMWindowProxy getMostRecentNonPBWindow(in wstring aWindowType);
|
|
|
|
|
2013-05-07 20:34:20 +04:00
|
|
|
/**
|
|
|
|
* Return the outer window with the given ID, if any. Can return null.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
mozIDOMWindowProxy getOuterWindowWithId(in unsigned long long aOuterWindowID);
|
2013-05-07 20:34:20 +04:00
|
|
|
|
2013-05-14 19:34:12 +04:00
|
|
|
/**
|
2016-01-30 20:05:36 +03:00
|
|
|
* Return the inner window with the given current window ID, if any.
|
2013-05-14 19:34:12 +04:00
|
|
|
* Can return null if no inner window with the ID exists or if it's not
|
|
|
|
* a current inner anymore.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
mozIDOMWindow getCurrentInnerWindowWithId(in unsigned long long aInnerWindowID);
|
2013-05-14 19:34:12 +04:00
|
|
|
|
2003-10-07 05:19:16 +04:00
|
|
|
/** Add the window to the list of known windows. Listeners (see
|
|
|
|
* addListener) will be notified through their onOpenWindow method.
|
|
|
|
* @param aWindow the window to add
|
|
|
|
*/
|
|
|
|
[noscript] void registerWindow(in nsIXULWindow aWindow);
|
|
|
|
|
|
|
|
/** Remove the window from the list of known windows. Listeners (see
|
|
|
|
* addListener) will be be notified through their onCloseWindow method.
|
|
|
|
* @param aWindow the window to remove
|
|
|
|
*/
|
|
|
|
[noscript] void unregisterWindow(in nsIXULWindow aWindow);
|
|
|
|
|
|
|
|
/** Call this method when a window gains focus. It's a primitive means of
|
|
|
|
* determining the most recent window. It's no longer necessary and it
|
|
|
|
* really should be removed.
|
|
|
|
* @param aWindow the window which has gained focus
|
|
|
|
*/
|
|
|
|
[noscript] void updateWindowTimeStamp(in nsIXULWindow aWindow);
|
|
|
|
|
|
|
|
/* z-ordering: */
|
|
|
|
|
|
|
|
const unsigned long zLevelTop = 1;
|
|
|
|
const unsigned long zLevelBottom = 2;
|
|
|
|
const unsigned long zLevelBelow = 3; // below some window
|
|
|
|
|
|
|
|
/** A window wants to be moved in z-order. Calculate whether and how
|
|
|
|
* it should be constrained. Note this method is advisory only:
|
|
|
|
* it changes nothing either in WindowMediator's internal state
|
|
|
|
* or with the window.
|
|
|
|
* Note it compares the nsIXULWindow to nsIWidgets. A pure interface
|
|
|
|
* would use all nsIXULWindows. But we expect this to be called from
|
|
|
|
* callbacks originating in native window code. They are expected to
|
|
|
|
* hand us comparison values which are pulled from general storage
|
|
|
|
* in the native widget, and may not correspond to an nsIWidget at all.
|
|
|
|
* For that reason this interface requires only objects one step
|
|
|
|
* removed from the native window (nsIWidgets), and its implementation
|
|
|
|
* must be very understanding of what may be completely invalid
|
|
|
|
* pointers in those parameters.
|
|
|
|
*
|
|
|
|
* @param inWindow the window in question
|
|
|
|
* @param inPosition requested position
|
|
|
|
* values: zLevelTop: topmost window. zLevelBottom: bottom.
|
|
|
|
* zLevelBelow: below ioBelow. (the value of ioBelow will
|
|
|
|
* be ignored for zLevelTop and Bottom.)
|
|
|
|
* @param inBelow if inPosition==zLevelBelow, the window
|
|
|
|
* below which inWindow wants to be placed. Otherwise this
|
|
|
|
* variable is ignored.
|
|
|
|
* @param outPosition constrained position, values like inPosition.
|
|
|
|
* @param outBelow if outPosition==zLevelBelow, the window
|
|
|
|
* below which inWindow should be placed. Otherwise this
|
|
|
|
* this value will be null.
|
2012-10-25 20:32:24 +04:00
|
|
|
* @return PR_TRUE if the position returned is different from
|
2003-10-07 05:19:16 +04:00
|
|
|
* the position given.
|
|
|
|
*/
|
|
|
|
|
|
|
|
[noscript] boolean calculateZPosition(in nsIXULWindow inWindow,
|
|
|
|
in unsigned long inPosition,
|
|
|
|
in nsIWidget inBelow,
|
|
|
|
out unsigned long outPosition,
|
|
|
|
out nsIWidget outBelow);
|
|
|
|
|
|
|
|
/** A window has been positioned behind another. Inform WindowMediator
|
|
|
|
* @param inWindow the window in question
|
|
|
|
* @param inPosition new position. values:
|
|
|
|
* zLevelTop: topmost window.
|
|
|
|
* zLevelBottom: bottom.
|
|
|
|
* zLevelBelow: below inBelow. (inBelow is ignored
|
|
|
|
* for other values of inPosition.)
|
|
|
|
* @param inBelow the window inWindow is behind, if zLevelBelow
|
|
|
|
*/
|
|
|
|
[noscript] void setZPosition(in nsIXULWindow inWindow,
|
|
|
|
in unsigned long inPosition,
|
|
|
|
in nsIXULWindow inBelow);
|
|
|
|
|
|
|
|
/** Return the window's Z level (as defined in nsIXULWindow).
|
|
|
|
* @param aWindow the window in question
|
|
|
|
* @return aWindow's z level
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
[noscript] uint32_t getZLevel(in nsIXULWindow aWindow);
|
2003-10-07 05:19:16 +04:00
|
|
|
|
|
|
|
/** Set the window's Z level (as defined in nsIXULWindow). The implementation
|
|
|
|
* will reposition the window as necessary to match its new Z level.
|
|
|
|
* The implementation will assume a window's Z level to be
|
|
|
|
* nsIXULWindow::normalZ until it has been informed of a different level.
|
|
|
|
* @param aWindow the window in question
|
|
|
|
* @param aZLevel the window's new Z level
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
[noscript] void setZLevel(in nsIXULWindow aWindow, in uint32_t aZLevel);
|
1999-06-16 08:23:37 +04:00
|
|
|
|
2003-10-07 05:19:16 +04:00
|
|
|
/** Register a listener for window status changes.
|
|
|
|
* keeps strong ref? (to be decided)
|
|
|
|
* @param aListener the listener to register
|
2001-09-25 02:31:49 +04:00
|
|
|
*/
|
2003-10-07 05:19:16 +04:00
|
|
|
void addListener(in nsIWindowMediatorListener aListener);
|
2001-09-25 02:31:49 +04:00
|
|
|
|
2003-10-07 05:19:16 +04:00
|
|
|
/** Unregister a listener of window status changes.
|
|
|
|
* @param aListener the listener to unregister
|
2001-09-25 02:31:49 +04:00
|
|
|
*/
|
2003-10-07 05:19:16 +04:00
|
|
|
void removeListener(in nsIWindowMediatorListener aListener);
|
1999-06-16 08:23:37 +04:00
|
|
|
};
|