xpfe/appshell/public/nsIWindowMediator.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "nsISupports.idl"
     7 #include "nsISimpleEnumerator.idl"
     9 %{C++
    10 #define NS_WINDOWMEDIATOR_CID \
    11 { 0x79a2b7cc, 0xf05b, 0x4605, \
    12   { 0xbf, 0xa0, 0xfa, 0xc5, 0x4f, 0x27, 0xee, 0xc8 } }
    14 #define NS_WINDOWMEDIATOR_CONTRACTID \
    15   "@mozilla.org/appshell/window-mediator;1"
    16 %}
    18 interface nsIXULWindow;
    19 interface nsIWidget;
    20 interface nsIDOMWindow;
    21 interface nsIWindowMediatorListener;
    23 [scriptable, uuid(30cda5a1-a6df-4f32-9a73-0e59a32928c5)]
    24 interface nsIWindowMediator: nsISupports
    25 {
    26   /** Return an enumerator which iterates over all windows of type aWindowType
    27     * from the oldest window to the youngest.
    28     * @param  aWindowType the returned enumerator will enumerate only
    29     *                     windows of this type. ("type" is the
    30     *                     |windowtype| attribute of the XML <window> element.)
    31     *                     If null, all windows will be enumerated.
    32     * @return an enumerator of nsIDOMWindows.  Note that windows close
    33     *         asynchronously in many cases, so windows returned from this
    34     *         enumerator can have .closed set to true.  Caveat enumerator!
    35     */
    36   nsISimpleEnumerator getEnumerator(in wstring aWindowType);
    38   /** Identical to getEnumerator except:
    39     * @return an enumerator of nsIXULWindows
    40   */
    41   nsISimpleEnumerator getXULWindowEnumerator(in wstring aWindowType);
    43   /** Return an enumerator which iterates over all windows of type aWindowType
    44     * in their z (front-to-back) order. Note this interface makes
    45     * no requirement that a window couldn't be revisited if windows
    46     * are re-ordered while z-order enumerators are active.
    47     * @param  aWindowType the returned enumerator will enumerate only
    48     *                     windows of this type. ("type" is the
    49     *                     |windowtype| attribute of the XML <window> element.)
    50     *                     If null, all windows will be enumerated.
    51     * @param  aFrontToBack if true, the enumerator enumerates windows in order
    52     *                      from front to back. back to front if false.
    53     * @return an enumerator of nsIDOMWindows
    54     */
    55   nsISimpleEnumerator getZOrderDOMWindowEnumerator(in wstring aWindowType,
    56                         in boolean aFrontToBack);
    58   /** Identical to getZOrderDOMWindowEnumerator except:
    59     * @return an enumerator of nsIXULWindows
    60     */
    61   nsISimpleEnumerator getZOrderXULWindowEnumerator(in wstring aWindowType,
    62                         in boolean aFrontToBack);
    64   /** This is a shortcut for simply fetching the first window in
    65     * front to back order.
    66     * @param  aWindowType return the topmost window of this type.
    67     *                     ("type" is the |windowtype| attribute of
    68     *                     the XML <window> element.)
    69     *                     If null, return the topmost window of any type.
    70     * @return the topmost window
    71     */
    72   nsIDOMWindow getMostRecentWindow(in wstring aWindowType);
    74   /**
    75    * Return the outer window with the given ID, if any.  Can return null.
    76    */
    77   nsIDOMWindow getOuterWindowWithId(in unsigned long long aOuterWindowID);
    79   /**
    80     * Return the outer window with the given current window ID, if any.
    81     * Can return null if no inner window with the ID exists or if it's not
    82     * a current inner anymore.
    83     */
    84   nsIDOMWindow getCurrentInnerWindowWithId(in unsigned long long aInnerWindowID);
    86   /** Add the window to the list of known windows. Listeners (see
    87     * addListener) will be notified through their onOpenWindow method.
    88     * @param aWindow the window to add
    89     */
    90   [noscript] void registerWindow(in nsIXULWindow aWindow);
    92   /** Remove the window from the list of known windows. Listeners (see
    93     * addListener) will be be notified through their onCloseWindow method.
    94     * @param aWindow the window to remove
    95     */
    96   [noscript] void unregisterWindow(in nsIXULWindow aWindow);
    98   /** Call this method when a window gains focus. It's a primitive means of
    99     * determining the most recent window. It's no longer necessary and it
   100     * really should be removed.
   101     * @param aWindow the window which has gained focus
   102     */
   103   [noscript] void updateWindowTimeStamp(in nsIXULWindow aWindow);
   105   /** Call this method when a window's title changes. Listeners (see
   106     * addListener) will be notified through their onWindowTitleChange method.
   107     * @param aWindow the window whose title has changed
   108     * @param inTitle the window's new title
   109     */
   110   [noscript] void updateWindowTitle(in nsIXULWindow aWindow,
   111                                     in wstring inTitle );
   113   /* z-ordering: */
   115   const unsigned long zLevelTop    = 1;
   116   const unsigned long zLevelBottom = 2;
   117   const unsigned long zLevelBelow  = 3; // below some window
   119   /** A window wants to be moved in z-order. Calculate whether and how
   120     * it should be constrained. Note this method is advisory only:
   121     * it changes nothing either in WindowMediator's internal state
   122     * or with the window.
   123     * Note it compares the nsIXULWindow to nsIWidgets. A pure interface
   124     * would use all nsIXULWindows. But we expect this to be called from
   125     * callbacks originating in native window code. They are expected to
   126     * hand us comparison values which are pulled from general storage
   127     * in the native widget, and may not correspond to an nsIWidget at all.
   128     * For that reason this interface requires only objects one step
   129     * removed from the native window (nsIWidgets), and its implementation
   130     * must be very understanding of what may be completely invalid
   131     * pointers in those parameters.
   132     *
   133     * @param inWindow the window in question
   134     * @param inPosition requested position
   135     *                   values: zLevelTop: topmost window. zLevelBottom: bottom.
   136     *                   zLevelBelow: below ioBelow. (the value of ioBelow will
   137     *                   be ignored for zLevelTop and Bottom.)
   138     * @param inBelow if inPosition==zLevelBelow, the window
   139     *                 below which inWindow wants to be placed. Otherwise this
   140     *                 variable is ignored.
   141     * @param outPosition constrained position, values like inPosition.
   142     * @param outBelow if outPosition==zLevelBelow, the window
   143     *                 below which inWindow should be placed. Otherwise this
   144     *                 this value will be null.
   145     * @return PR_TRUE if the position returned is different from
   146     *         the position given.
   147     */
   149   [noscript] boolean calculateZPosition(in nsIXULWindow   inWindow,
   150                                         in unsigned long  inPosition,
   151                                         in nsIWidget      inBelow,
   152                                         out unsigned long outPosition,
   153                                         out nsIWidget     outBelow);
   155   /** A window has been positioned behind another. Inform WindowMediator
   156     * @param inWindow the window in question
   157     * @param inPosition new position. values:
   158     *                   zLevelTop: topmost window.
   159     *                   zLevelBottom: bottom.
   160     *                   zLevelBelow: below inBelow. (inBelow is ignored
   161     *                                for other values of inPosition.)
   162     * @param inBelow the window inWindow is behind, if zLevelBelow
   163     */
   164   [noscript] void setZPosition(in nsIXULWindow inWindow,
   165                                in unsigned long inPosition,
   166                                in nsIXULWindow inBelow);
   168   /** Return the window's Z level (as defined in nsIXULWindow).
   169     * @param aWindow the window in question
   170     * @return aWindow's z level
   171     */
   172   [noscript] uint32_t getZLevel(in nsIXULWindow aWindow);
   174   /** Set the window's Z level (as defined in nsIXULWindow). The implementation
   175     * will reposition the window as necessary to match its new Z level.
   176     * The implementation will assume a window's Z level to be
   177     * nsIXULWindow::normalZ until it has been informed of a different level.
   178     * @param aWindow the window in question
   179     * @param aZLevel the window's new Z level
   180     */
   181   [noscript] void setZLevel(in nsIXULWindow aWindow, in uint32_t aZLevel);
   183   /** Register a listener for window status changes.
   184     * keeps strong ref? (to be decided)
   185     * @param aListener the listener to register
   186     */
   187   void addListener(in nsIWindowMediatorListener aListener);
   189   /** Unregister a listener of window status changes.
   190     * @param aListener the listener to unregister
   191     */
   192   void removeListener(in nsIWindowMediatorListener aListener);
   193 };

mercurial