1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpfe/appshell/public/nsIWindowMediator.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,193 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 +#include "nsISimpleEnumerator.idl" 1.11 + 1.12 +%{C++ 1.13 +#define NS_WINDOWMEDIATOR_CID \ 1.14 +{ 0x79a2b7cc, 0xf05b, 0x4605, \ 1.15 + { 0xbf, 0xa0, 0xfa, 0xc5, 0x4f, 0x27, 0xee, 0xc8 } } 1.16 + 1.17 +#define NS_WINDOWMEDIATOR_CONTRACTID \ 1.18 + "@mozilla.org/appshell/window-mediator;1" 1.19 +%} 1.20 + 1.21 +interface nsIXULWindow; 1.22 +interface nsIWidget; 1.23 +interface nsIDOMWindow; 1.24 +interface nsIWindowMediatorListener; 1.25 + 1.26 +[scriptable, uuid(30cda5a1-a6df-4f32-9a73-0e59a32928c5)] 1.27 +interface nsIWindowMediator: nsISupports 1.28 +{ 1.29 + /** Return an enumerator which iterates over all windows of type aWindowType 1.30 + * from the oldest window to the youngest. 1.31 + * @param aWindowType the returned enumerator will enumerate only 1.32 + * windows of this type. ("type" is the 1.33 + * |windowtype| attribute of the XML <window> element.) 1.34 + * If null, all windows will be enumerated. 1.35 + * @return an enumerator of nsIDOMWindows. Note that windows close 1.36 + * asynchronously in many cases, so windows returned from this 1.37 + * enumerator can have .closed set to true. Caveat enumerator! 1.38 + */ 1.39 + nsISimpleEnumerator getEnumerator(in wstring aWindowType); 1.40 + 1.41 + /** Identical to getEnumerator except: 1.42 + * @return an enumerator of nsIXULWindows 1.43 + */ 1.44 + nsISimpleEnumerator getXULWindowEnumerator(in wstring aWindowType); 1.45 + 1.46 + /** Return an enumerator which iterates over all windows of type aWindowType 1.47 + * in their z (front-to-back) order. Note this interface makes 1.48 + * no requirement that a window couldn't be revisited if windows 1.49 + * are re-ordered while z-order enumerators are active. 1.50 + * @param aWindowType the returned enumerator will enumerate only 1.51 + * windows of this type. ("type" is the 1.52 + * |windowtype| attribute of the XML <window> element.) 1.53 + * If null, all windows will be enumerated. 1.54 + * @param aFrontToBack if true, the enumerator enumerates windows in order 1.55 + * from front to back. back to front if false. 1.56 + * @return an enumerator of nsIDOMWindows 1.57 + */ 1.58 + nsISimpleEnumerator getZOrderDOMWindowEnumerator(in wstring aWindowType, 1.59 + in boolean aFrontToBack); 1.60 + 1.61 + /** Identical to getZOrderDOMWindowEnumerator except: 1.62 + * @return an enumerator of nsIXULWindows 1.63 + */ 1.64 + nsISimpleEnumerator getZOrderXULWindowEnumerator(in wstring aWindowType, 1.65 + in boolean aFrontToBack); 1.66 + 1.67 + /** This is a shortcut for simply fetching the first window in 1.68 + * front to back order. 1.69 + * @param aWindowType return the topmost window of this type. 1.70 + * ("type" is the |windowtype| attribute of 1.71 + * the XML <window> element.) 1.72 + * If null, return the topmost window of any type. 1.73 + * @return the topmost window 1.74 + */ 1.75 + nsIDOMWindow getMostRecentWindow(in wstring aWindowType); 1.76 + 1.77 + /** 1.78 + * Return the outer window with the given ID, if any. Can return null. 1.79 + */ 1.80 + nsIDOMWindow getOuterWindowWithId(in unsigned long long aOuterWindowID); 1.81 + 1.82 + /** 1.83 + * Return the outer window with the given current window ID, if any. 1.84 + * Can return null if no inner window with the ID exists or if it's not 1.85 + * a current inner anymore. 1.86 + */ 1.87 + nsIDOMWindow getCurrentInnerWindowWithId(in unsigned long long aInnerWindowID); 1.88 + 1.89 + /** Add the window to the list of known windows. Listeners (see 1.90 + * addListener) will be notified through their onOpenWindow method. 1.91 + * @param aWindow the window to add 1.92 + */ 1.93 + [noscript] void registerWindow(in nsIXULWindow aWindow); 1.94 + 1.95 + /** Remove the window from the list of known windows. Listeners (see 1.96 + * addListener) will be be notified through their onCloseWindow method. 1.97 + * @param aWindow the window to remove 1.98 + */ 1.99 + [noscript] void unregisterWindow(in nsIXULWindow aWindow); 1.100 + 1.101 + /** Call this method when a window gains focus. It's a primitive means of 1.102 + * determining the most recent window. It's no longer necessary and it 1.103 + * really should be removed. 1.104 + * @param aWindow the window which has gained focus 1.105 + */ 1.106 + [noscript] void updateWindowTimeStamp(in nsIXULWindow aWindow); 1.107 + 1.108 + /** Call this method when a window's title changes. Listeners (see 1.109 + * addListener) will be notified through their onWindowTitleChange method. 1.110 + * @param aWindow the window whose title has changed 1.111 + * @param inTitle the window's new title 1.112 + */ 1.113 + [noscript] void updateWindowTitle(in nsIXULWindow aWindow, 1.114 + in wstring inTitle ); 1.115 + 1.116 + /* z-ordering: */ 1.117 + 1.118 + const unsigned long zLevelTop = 1; 1.119 + const unsigned long zLevelBottom = 2; 1.120 + const unsigned long zLevelBelow = 3; // below some window 1.121 + 1.122 + /** A window wants to be moved in z-order. Calculate whether and how 1.123 + * it should be constrained. Note this method is advisory only: 1.124 + * it changes nothing either in WindowMediator's internal state 1.125 + * or with the window. 1.126 + * Note it compares the nsIXULWindow to nsIWidgets. A pure interface 1.127 + * would use all nsIXULWindows. But we expect this to be called from 1.128 + * callbacks originating in native window code. They are expected to 1.129 + * hand us comparison values which are pulled from general storage 1.130 + * in the native widget, and may not correspond to an nsIWidget at all. 1.131 + * For that reason this interface requires only objects one step 1.132 + * removed from the native window (nsIWidgets), and its implementation 1.133 + * must be very understanding of what may be completely invalid 1.134 + * pointers in those parameters. 1.135 + * 1.136 + * @param inWindow the window in question 1.137 + * @param inPosition requested position 1.138 + * values: zLevelTop: topmost window. zLevelBottom: bottom. 1.139 + * zLevelBelow: below ioBelow. (the value of ioBelow will 1.140 + * be ignored for zLevelTop and Bottom.) 1.141 + * @param inBelow if inPosition==zLevelBelow, the window 1.142 + * below which inWindow wants to be placed. Otherwise this 1.143 + * variable is ignored. 1.144 + * @param outPosition constrained position, values like inPosition. 1.145 + * @param outBelow if outPosition==zLevelBelow, the window 1.146 + * below which inWindow should be placed. Otherwise this 1.147 + * this value will be null. 1.148 + * @return PR_TRUE if the position returned is different from 1.149 + * the position given. 1.150 + */ 1.151 + 1.152 + [noscript] boolean calculateZPosition(in nsIXULWindow inWindow, 1.153 + in unsigned long inPosition, 1.154 + in nsIWidget inBelow, 1.155 + out unsigned long outPosition, 1.156 + out nsIWidget outBelow); 1.157 + 1.158 + /** A window has been positioned behind another. Inform WindowMediator 1.159 + * @param inWindow the window in question 1.160 + * @param inPosition new position. values: 1.161 + * zLevelTop: topmost window. 1.162 + * zLevelBottom: bottom. 1.163 + * zLevelBelow: below inBelow. (inBelow is ignored 1.164 + * for other values of inPosition.) 1.165 + * @param inBelow the window inWindow is behind, if zLevelBelow 1.166 + */ 1.167 + [noscript] void setZPosition(in nsIXULWindow inWindow, 1.168 + in unsigned long inPosition, 1.169 + in nsIXULWindow inBelow); 1.170 + 1.171 + /** Return the window's Z level (as defined in nsIXULWindow). 1.172 + * @param aWindow the window in question 1.173 + * @return aWindow's z level 1.174 + */ 1.175 + [noscript] uint32_t getZLevel(in nsIXULWindow aWindow); 1.176 + 1.177 + /** Set the window's Z level (as defined in nsIXULWindow). The implementation 1.178 + * will reposition the window as necessary to match its new Z level. 1.179 + * The implementation will assume a window's Z level to be 1.180 + * nsIXULWindow::normalZ until it has been informed of a different level. 1.181 + * @param aWindow the window in question 1.182 + * @param aZLevel the window's new Z level 1.183 + */ 1.184 + [noscript] void setZLevel(in nsIXULWindow aWindow, in uint32_t aZLevel); 1.185 + 1.186 + /** Register a listener for window status changes. 1.187 + * keeps strong ref? (to be decided) 1.188 + * @param aListener the listener to register 1.189 + */ 1.190 + void addListener(in nsIWindowMediatorListener aListener); 1.191 + 1.192 + /** Unregister a listener of window status changes. 1.193 + * @param aListener the listener to unregister 1.194 + */ 1.195 + void removeListener(in nsIWindowMediatorListener aListener); 1.196 +};