1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
12 * When the window is destroyed, it will fire a "xul-window-destroyed"
13 * notification through the global observer service.
17 #include
"LiveResizeListener.h"
21 interface nsIDocShell
;
22 interface nsIDocShellTreeItem
;
23 interface nsIXULBrowserWindow
;
24 interface nsIRemoteTab
;
25 interface mozIDOMWindowProxy
;
26 interface nsIOpenWindowInfo
;
28 native LiveResizeListenerArray
(nsTArray
<RefPtr
<mozilla
::LiveResizeListener
>>);
30 [builtinclass
, scriptable
, uuid(d6d7a014
-e28d
-4c9d
-8727-1cf6d870619b
)]
31 interface nsIAppWindow
: nsISupports
34 * The docshell owning the XUL for this window.
36 readonly attribute nsIDocShell docShell
;
39 * Indicates if this window is instrinsically sized.
41 attribute
boolean intrinsicallySized
;
44 * The primary content shell.
46 * Note that this is a docshell tree item and therefore can not be assured of
47 * what object it is. It could be an editor, a docshell, or a browser object.
48 * Or down the road any other object that supports being a DocShellTreeItem
49 * Query accordingly to determine the capabilities.
51 readonly attribute nsIDocShellTreeItem primaryContentShell
;
54 * In multiprocess case we may not have primaryContentShell but
57 readonly attribute nsIRemoteTab primaryRemoteTab
;
59 void remoteTabAdded
(in nsIRemoteTab aTab
, in boolean aPrimary
);
60 void remoteTabRemoved
(in nsIRemoteTab aTab
);
62 [noscript
,notxpcom
] LiveResizeListenerArray getLiveResizeListeners
();
65 * Tell this window that it has picked up a child XUL window
66 * @param aChild the child window being added
68 void addChildWindow
(in nsIAppWindow aChild
);
71 * Returns the difference between the inner window size (client size) and the
72 * outer window size, in CSS pixels.
74 [infallible
] readonly attribute
unsigned long outerToInnerHeightDifferenceInCSSPixels
;
75 [infallible
] readonly attribute
unsigned long outerToInnerWidthDifferenceInCSSPixels
;
78 * Tell this window that it has lost a child XUL window
79 * @param aChild the child window being removed
81 void removeChildWindow
(in nsIAppWindow aChild
);
84 * Move the window to a centered position.
85 * @param aRelative If not null, the window relative to which the window is
86 * moved. See aScreen parameter for details.
87 * @param aScreen PR_TRUE to center the window relative to the screen
88 * containing aRelative if aRelative is not null. If
89 * aRelative is null then relative to the screen of the
90 * opener window if it was initialized by passing it to
91 * nsWebShellWindow::Initialize. Failing that relative to
93 * PR_FALSE to center it relative to aRelative itself.
94 * @param aAlert PR_TRUE to move the window to an alert position,
95 * generally centered horizontally and 1/3 down from the top.
97 void center
(in nsIAppWindow aRelative
, in boolean aScreen
, in boolean aAlert
);
100 * Shows the window as a modal window. That is, ensures that it is visible
101 * and runs a local event loop, exiting only once the window has been closed.
106 * Locks the aspect ratio for a window.
107 * @param aShouldLock boolean
109 void lockAspectRatio
(in bool aShouldLock
);
111 const unsigned long lowestZ
= 0;
112 const unsigned long loweredZ
= 4; /* "alwaysLowered" attribute */
113 const unsigned long normalZ
= 5;
114 const unsigned long raisedZ
= 6; /* "alwaysRaised" attribute */
115 const unsigned long highestZ
= 9;
117 attribute
unsigned long zLevel
;
119 attribute uint32_t chromeFlags
;
122 * Begin assuming |chromeFlags| don't change hereafter, and assert
123 * if they do change. The state change is one-way and idempotent.
125 void assumeChromeFlagsAreFrozen
();
128 * Create a new window.
129 * @param aChromeFlags see nsIWebBrowserChrome
130 * @param aOpenWindowInfo information about the request for a content window
131 * to be opened. Will be null for non-content loads.
132 * @return the newly minted window
134 nsIAppWindow createNewWindow
(in int32_t aChromeFlags
,
135 in nsIOpenWindowInfo aOpenWindowInfo
);
137 attribute nsIXULBrowserWindow XULBrowserWindow
;
140 * Back-door method to make sure some stuff is done when the document is
141 * ready for layout, that would cause expensive computation otherwise later.
143 * Do NOT call this unless you know what you're doing! In particular,
144 * calling this when this XUL window doesn't yet have a document in its
145 * docshell could cause problems.
147 [noscript
] void beforeStartLayout
();
150 * Given the dimensions of some content area held within this
151 * XUL window, and assuming that that content area will change
152 * its dimensions in linear proportion to the dimensions of this
153 * XUL window, changes the size of the XUL window so that the
154 * content area reaches a particular size.
156 * We need to supply the content area dimensions because sometimes
157 * the child's nsDocShellTreeOwner needs to propagate a SizeShellTo
158 * call to the parent. But the shellItem argument of the call will
159 * not be available on the parent side.
161 * Note: this is an internal method, other consumers should never call this.
163 * @param aDesiredWidth
164 * The desired width of the content area in device pixels.
165 * @param aDesiredHeight
166 * The desired height of the content area in device pixels.
167 * @param shellItemWidth
168 * The current width of the content area.
169 * @param shellItemHeight
170 * The current height of the content area.
172 [noscript
, notxpcom
] void sizeShellToWithLimit
(in int32_t aDesiredWidth
,
173 in int32_t aDesiredHeight
,
174 in int32_t shellItemWidth
,
175 in int32_t shellItemHeight
);
178 * If the window was opened as a content window, this will return the initial
179 * nsIOpenWindowInfo to use.
181 readonly attribute nsIOpenWindowInfo initialOpenWindowInfo
;