gecko-dev/xpfe/appshell/public/nsIAppShellService.idl

180 lines
6.7 KiB
Plaintext

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsISupports.idl"
#include "domstubs.idl"
%{C++
#include "nscore.h"
#include "nsCom.h"
%}
interface nsIWebShellWindow;
interface nsIURI;
interface nsIXULWindowCallbacks;
interface nsICmdLineService;
[ptr] native JSContext(JSContext);
%{C++
/* Forward declarations... */
struct PRThread;
class nsIFactory;
struct JSContext;
#define NS_SIZETOCONTENT -1
// e5e5af70-8a38-11d2-9938-0080c7cb1080
#define NS_IAPPSHELL_SERVICE_IID \
{ 0xe5e5af70, 0x8a38, 0x11d2, \
{0x99, 0x38, 0x00, 0x80, 0xc7, 0xcb, 0x10, 0x80} }
%}
[scriptable, uuid(E5E5AF70-8A38-11D2-9938-0080C7CB1080)]
interface nsIAppShellService : nsISupports
{
/**
* Required initialization routine.
* @param aCmdLineService is stored and passed to appshell components as
* they are initialized.
*/
void Initialize(in nsICmdLineService aCmdLineService);
/**
* Runs an application event loop: normally the main event pump which
* defines the lifetime of the application.
*/
void Run();
// Exit the event loop
void Quit();
/**
* Required exit routine. Cleanly shuts down
* the appshell components.
*/
void Shutdown();
/**
* 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.
*/
void CreateTopLevelWindow(in nsIWebShellWindow aParent,
in nsIURI aUrl,
in boolean aShowWindow,
in boolean aLoadDefaultPage,
in PRUint32 aChromeMask,
in nsIXULWindowCallbacks aCallbacks,
in long aInitialWidth, in long aInitialHeight,
out nsIWebShellWindow aResult);
/**
* Run a window modally.
* @param aWindow the window to run modally. If null or pointing to null,
* a new window is created. If aWindow != null, the window
* is returned from this method, but callers should use it
* carefully: it's been closed, and is therefore partially
* deconstructed. Note that all other parameters are ignored
* if an already created window is passed in.
* @param aParent the parent window. Can be null.
* @param aUrl the contents of the window.
* @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. 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.
*/
void RunModalDialog( inout nsIWebShellWindow aWindow,
in nsIWebShellWindow aParent,
in nsIURI aUrl,
in PRUint32 aChromeMask,
in nsIXULWindowCallbacks aCallbacks,
in long aInitialWidth, in long aInitialHeight);
// Apply Initialize function to each app shell component.
void EnumerateAndInitializeComponents();
/**
* Close a window.
* @param aWindow a window.
*/
void CloseTopLevelWindow(in nsIWebShellWindow 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.
*/
void GetHiddenWindow(out nsIWebShellWindow aResult);
/**
* Return the (singleton) application hidden window as an nsIDOMWindow,
* 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 nsIDOMWindow
* @aJSContext the corresponding JavaScript context
*/
[noscript]
void GetHiddenWindowAndJSContext(out nsIDOMWindow 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 nsIWebShellWindow aWindow);
/**
* Remove a window from the application's window registry.
* @param aWindow you see the pattern
*/
void UnregisterTopLevelWindow(in nsIWebShellWindow aWindow);
};