/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: NPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Netscape Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/NPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the NPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the NPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsISupports.idl" interface nsIXULWindow; interface nsIURI; interface nsICmdLineService; interface nsINativeAppSupport; interface nsIDOMWindowInternal; [ptr] native JSContext(JSContext); %{C++ struct JSContext; %} [scriptable, uuid(E5E5AF70-8A38-11D2-9938-0080C7CB1080)] interface nsIAppShellService : nsISupports { const PRUint32 eConsiderQuit = 1; // attempt to quit if all windows are closed const PRUint32 eAttemptQuit = 2; // try to close all windows, then quit if successful const PRUint32 eForceQuit = 3; // quit, damnit /** * Required initialization routine. * @param aCmdLineService is stored and passed to appshell components as * they are initialized. * @param aNativeAppSupportOrSplashScreen is an object that can be * QI'd to either an nsINativeAppSupport or * nsISplashScreen; this object will be used to * implement HideSplashScreen. */ void initialize(in nsICmdLineService aCmdLineService, in nsISupports nativeAppSupportOrSplashScreen); /** * Starts up the profile manager with the given arguments * @param aCmdLineService the arguments given to the program * @param canInteract If FALSE and UI is needed, will fail */ void doProfileStartup(in nsICmdLineService aCmdLineService, in boolean canInteract); /** * Getter for "native app support." */ readonly attribute nsINativeAppSupport nativeAppSupport; /** * Runs an application event loop: normally the main event pump which * defines the lifetime of the application. */ void run(); /** * Exit the event loop, shut down the app */ void quit(in PRUint32 aFerocity); /** * Create a window. * @param aParent the parent window. Can be null. * @param aUrl the contents of the new window. * @param aShowWindow the window remains invisible if PR_FALSE. * @param aLoadDefaultPage controls whether the window should try to * load a default content page on its own. * @param aChromeMask chrome flags affecting the kind of OS border * given to the window. see nsIBrowserWindow for * bit/flag definitions. * @param aCallbacks interface providing C++ hooks for window initialization * before the window is made visible. Can be null. * Deprecated. * @param aInitialWidth width, in pixels, of the window. Width of window * at creation. Can be overridden by the "width" * tag in the XUL. Set to NS_SIZETOCONTENT to force * the window to wrap to its contents. * @param aInitialHeight like aInitialWidth, but subtly different. * @param aResult the newly created window is returned here. */ const long SIZE_TO_CONTENT = -1; nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent, in nsIURI aUrl, in boolean aShowWindow, in boolean aLoadDefaultPage, in PRUint32 aChromeMask, in long aInitialWidth, in long aInitialHeight); /** * Close a window. * @param aWindow a window. */ void closeTopLevelWindow(in nsIXULWindow aWindow); [noscript] void createHiddenWindow(); /** * Return the (singleton) application hidden window, automatically created * and maintained by this AppShellService. * @param aResult the hidden window. Do not unhide hidden window. * Do not taunt hidden window. */ readonly attribute nsIXULWindow hiddenWindow; /** * Return the (singleton) application hidden window, automatically created * and maintained by this AppShellService. * @param aResult the hidden window. Do not unhide hidden window. * Do not taunt hidden window. */ readonly attribute nsIDOMWindowInternal hiddenDOMWindow; /** * Return the (singleton) application hidden window as an nsIDOMWindowInternal, * and, the corresponding JavaScript context pointer. This is useful * if you'd like to subsequently call OpenDialog on the hidden window. * @aHiddenDOMWindow the hidden window QI'd to type nsIDOMWindowInternal * @aJSContext the corresponding JavaScript context */ [noscript] void getHiddenWindowAndJSContext(out nsIDOMWindowInternal aHiddenDOMWindow, out JSContext aJSContext); /** * Add a window to the application's registry of windows. These windows * are generally shown in the Windows taskbar, and the application * knows it can't quit until it's out of registered windows. * @param aWindow yes */ void registerTopLevelWindow(in nsIXULWindow aWindow); /** * Remove a window from the application's window registry. Note that * this method won't automatically attempt to quit the app when * the last window is unregistered. For that, see Quit(). * @param aWindow you see the pattern */ void unregisterTopLevelWindow(in nsIXULWindow aWindow); /** * The appshell service needs to be informed of modal XUL windows currently * open. Call this method as a window becomes modal or as it becomes * nonmodal. * @param aWindow no surprises here * @param aModal true if aWindow is becoming modal * false if aWindow is becoming nonmodal (or being closed) */ void topLevelWindowIsModal(in nsIXULWindow aWindow, in boolean aModal); /** * Remove the splash screen (if visible). This need be called * only once per application session. */ void hideSplashScreen(); /** * During application startup (and at other times!) we may temporarily * encounter a situation where all application windows will be closed * but we don't want to take this as a signal to quit the app. Bracket * the code where the last window could close with these. * (And at application startup, on platforms that don't normally quit * when the last window has closed, call Enter once, but not Exit) */ void enterLastWindowClosingSurvivalArea(); void exitLastWindowClosingSurvivalArea(); };