1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is Mozilla Communicator client code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "nsISupports.idl"
39
40 interface nsIXULWindow;
41 interface nsIURI;
42 interface nsIDOMWindowInternal;
43 interface nsIAppShell;
44
45 [ptr] native JSContext(JSContext);
46
47 %{C++
48 struct JSContext;
49 %}
50
51 [scriptable, uuid(93a28ba2-7e22-11d9-9b6f-000a95d535fa)]
52 interface nsIAppShellService : nsISupports
53 {
54 /**
55 * Create a window, which will be initially invisible.
56 * @param aParent the parent window. Can be null.
57 * @param aUrl the contents of the new window.
58 * @param aChromeMask chrome flags affecting the kind of OS border
59 * given to the window. see nsIBrowserWindow for
60 * bit/flag definitions.
61 * @param aCallbacks interface providing C++ hooks for window initialization
62 * before the window is made visible. Can be null.
63 * Deprecated.
64 * @param aInitialWidth width, in pixels, of the window. Width of window
65 * at creation. Can be overridden by the "width"
66 * tag in the XUL. Set to NS_SIZETOCONTENT to force
67 * the window to wrap to its contents.
68 * @param aInitialHeight like aInitialWidth, but subtly different.
69 * @param aAppShell a widget "appshell" (event processor) to associate
70 * with the new window
71 * @param aResult the newly created window is returned here.
72 */
73 const long SIZE_TO_CONTENT = -1;
74 nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent,
75 in nsIURI aUrl,
76 in PRUint32 aChromeMask,
77 in long aInitialWidth,
78 in long aInitialHeight,
79 in nsIAppShell aAppShell);
80
81 [noscript]
82 void createHiddenWindow(in nsIAppShell aAppShell);
83
84 void destroyHiddenWindow();
85
86 /**
87 * Return the (singleton) application hidden window, automatically created
88 * and maintained by this AppShellService.
89 * @param aResult the hidden window. Do not unhide hidden window.
90 * Do not taunt hidden window.
91 */
92 readonly attribute nsIXULWindow hiddenWindow;
93
94 /**
95 * Return the (singleton) application hidden window, automatically created
96 * and maintained by this AppShellService.
97 * @param aResult the hidden window. Do not unhide hidden window.
98 * Do not taunt hidden window.
99 */
100 readonly attribute nsIDOMWindowInternal hiddenDOMWindow;
101
102 /**
103 * Return the (singleton) application hidden window as an nsIDOMWindowInternal,
104 * and, the corresponding JavaScript context pointer. This is useful
105 * if you'd like to subsequently call OpenDialog on the hidden window.
106 * @aHiddenDOMWindow the hidden window QI'd to type nsIDOMWindowInternal
107 * @aJSContext the corresponding JavaScript context
108 */
109 [noscript]
110 void getHiddenWindowAndJSContext(out nsIDOMWindowInternal aHiddenDOMWindow,
111 out JSContext aJSContext);
112
113 /**
114 * Return true if the application hidden window was provided by the
115 * application. If it wasn't, the default hidden window was used. This will
116 * usually be false on all non-mac platforms.
117 */
118 readonly attribute boolean applicationProvidedHiddenWindow;
119
120 /**
121 * Add a window to the application's registry of windows. These windows
122 * are generally shown in the Windows taskbar, and the application
123 * knows it can't quit until it's out of registered windows.
124 * @param aWindow the window to register
125 * @note When this method is successful, it fires the global notification
126 * "xul-window-registered"
127 */
128 void registerTopLevelWindow(in nsIXULWindow aWindow);
129
130 /**
131 * Remove a window from the application's window registry. Note that
132 * this method won't automatically attempt to quit the app when
133 * the last window is unregistered. For that, see Quit().
134 * @param aWindow you see the pattern
135 */
136 void unregisterTopLevelWindow(in nsIXULWindow aWindow);
137
138 /**
139 * The appshell service needs to be informed of modal XUL windows currently
140 * open. Call this method as a window becomes modal or as it becomes
141 * nonmodal.
142 * @param aWindow no surprises here
143 * @param aModal true if aWindow is becoming modal
144 * false if aWindow is becoming nonmodal (or being closed)
145 */
146 void topLevelWindowIsModal(in nsIXULWindow aWindow, in boolean aModal);
147 };