Visit Mozilla.org

nsIAppShellService

From MDC

This interface is intended to be used as a service.

Contents

nsIAppShellService is defined in xpfe/appshell/public/nsIAppShellService.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.9).

Inherits from: nsISupports


[edit] Method overview

nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent, in nsIURI aUrl, in PRUint32 aChromeMask, in long aInitialWidth, in long aInitialHeight, in nsIAppShell aAppShell);
void createHiddenWindow(in nsIAppShell aAppShell);
void destroyHiddenWindow();
void getHiddenWindowAndJSContext(out nsIDOMWindowInternal aHiddenDOMWindow, out JSContext aJSContext);
void registerTopLevelWindow(in nsIXULWindow aWindow);
void unregisterTopLevelWindow(in nsIXULWindow aWindow);
void topLevelWindowIsModal(in nsIXULWindow aWindow, in boolean aModal);

[edit] Attributes

Attribute Type Description
hiddenWindow nsIXULWindow Return the (singleton) application hidden window, automatically created and maintained by this AppShellService.Read only
hiddenDOMWindow nsIDOMWindowInternal Return the (singleton) application hidden window, automatically created and maintained by this AppShellService.Read only

[edit] Constants

Constant Value Description
SIZE_TO_CONTENT -1 Create a window, which will be initially invisible.

[edit] Methods

[edit] createTopLevelWindow()

This method creates a window, which will be initially invisible.

 nsIXULWindow createTopLevelWindow(
   in nsIXULWindow aParent,
   in nsIURI aUrl, 
   in PRUint32 aChromeMask,
   in long aInitialWidth,
   in long aInitialHeight,
   in nsIAppShell aAppShell
 );
[edit] Parameters
aParent
The parent window. Can be null.
aUrl
The contents of the new window.
aChromeMask
Chrome flags affecting the kind of OS border given to the window. see nsIBrowserWindow for bit/flag definitions.
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.
aInitialHeight
Like aInitialWidth, but subtly different.
aAppShell
A widget "appshell" (event processor) to associate with the new window.
[edit] Return value

Returns the newly created window.

[edit] createHiddenWindow()

Creates a hidden window.

 void createHiddenWindow(
   in nsIAppShell aAppShell
 );
[edit] Parameters
aAppShell
A widget "appshell" (event processor) to associate with the new window.

[edit] destroyHiddenWindow()

Destroys a hidden window.

 void destroyHiddenWindow(
 );
[edit] Parameters

None.

[edit] getHiddenWindowAndJSContext()

 void getHiddenWindowAndJSContext(
   out nsIDOMWindowInternal aHiddenDOMWindow,
   out JSContext aJSContext
 );
[edit] Parameters
aHiddenDOMWindow
The hidden window QI'd to type nsIDOMWindowInternal.
aJSContext
The corresponding JavaScript context.
[edit] Return value

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.

[edit] registerTopLevelWindow()

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.

Note: When this method is successful, it fires the global notification "xul-window-registered"
 void registerTopLevelWindow(
   in nsIXULWindow aWindow
 );
[edit] Parameters
aWindow
The window to register.

[edit] unregisterTopLevelWindow()

Remove a window from the application's window registry.

Note: This method won't automatically attempt to quit the app when the last window is unregistered. For that, see Quit().
 void unregisterTopLevelWindow(
   in nsIXULWindow aWindow
 );
[edit] Parameters
aWindow
The window to register.

[edit] topLevelWindowIsModal()

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.

 void topLevelWindowIsModal(
   in nsIXULWindow aWindow, 
   in boolean aModal
 );
[edit] Parameters
aWindow
The window to register.
aModal
True if aWindow is becoming modal false if aWindow is becoming nonmodal (or being closed).

[edit] See also