Visit Mozilla.org

nsIAppStartup

From MDC


The nsIAppStartup interface is intended to be used as application startup service. It also helps in quitting applications as well.

Contents

nsIAppStartup is defined in toolkit/components/startup/public/nsIAppStartup.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.9).

Inherits from: nsISupports

[edit] Method overview

void createHiddenWindow();
void destroyHiddenWindow();
void run();
void enterLastWindowClosingSurvivalArea();
void exitLastWindowClosingSurvivalArea();
void quit(in PRUint32 aMode);

[edit] Constants

Constant Value Description
eConsiderQuit 0x01 Attempt to quit if all windows are closed.

The following flags may be passed as the aMode parameter to the quit method. One and only one of the "Quit" flags must be specified. The eRestart flag may be bit-wise combined with one of the "Quit" flags to cause the application to restart after it quits.

eAttemptQuit 0x02 Try to close all windows, then quit if successful.

The following flags may be passed as the aMode parameter to the quit method. One and only one of the "Quit" flags must be specified. The eRestart flag may be bit-wise combined with one of the "Quit" flags to cause the application to restart after it quits.

eForceQuit 0x03 Quit, damnit!

The following flags may be passed as the aMode parameter to the quit method. One and only one of the "Quit" flags must be specified. The eRestart flag may be bit-wise combined with one of the "Quit" flags to cause the application to restart after it quits.

eRestart 0x10 Restart the application after quitting. The application will be restarted with the same profile and an empty command line.

The following flags may be passed as the aMode parameter to the quit method. One and only one of the "Quit" flags must be specified. The eRestart flag may be bit-wise combined with one of the "Quit" flags to cause the application to restart after it quits.

[edit] Methods

[edit] createHiddenWindow()

This method creates the hidden window.

 void createHiddenWindow();
[edit] Parameters

None.

[edit] destroyHiddenWindow()

This method destroys the hidden window. This will have no effect if the hidden window has not yet been created.

 void destroyHiddenWindow();
[edit] Parameters

None.

[edit] run()

This method runs an application event loop: normally the main event pump which defines the lifetime of the application. If there are no windows open and no outstanding calls to enterLastWindowClosingSurvivalArea this method will exit immediately.

 void run();
[edit] Parameters

None.

[edit] Return value

Returns NS_SUCCESS_RESTART_APP code. This return code indicates that the application should be restarted because quit was called with the eRestart flag.

[edit] enterLastWindowClosingSurvivalArea()

This method serves for situations when all application windows will be closed but we don't want to take this as a signal to quit the application. Bracket the code where the last window could close with these.

 void enterLastWindowClosingSurvivalArea();
[edit] Parameters

None.

[edit] exitLastWindowClosingSurvivalArea()

This method serves for situations when all application windows will be closed but we don't want to take this as a signal to quit the application. Bracket the code where the last window could close with these.

 void exitLastWindowClosingSurvivalArea();
[edit] Parameters

None.

[edit] quit()

This method exits the event loop, and shut down the application.

 void quit(
   in PRUint32 aMode
 );
[edit] Parameters
aMode
This parameter modifies how the application is shutdown, and it is constructed from the constants defined above.

[edit] See also