Index

Package: Applications

Description

package Applications is

Classes

Application (abstract)

type Application is abstract new Limited_Object with private;

Ancestors:

Immediate Children:

Applications.Keen.Keen_Application
Applications.Shell.Shell_Application

Primitive operations:

Construct
Delete (overriding Objects.Delete)
Init
Objects.Construct (Inherited)
Objects.To_String (Inherited)
An Application is a global singleton class that implements an application's initialization, runtime and shutdown behavior, and provides some meta information about it. If an application's initialization fails, it will not be run or closed.

Types

A_Application

type A_Application is access all Application'Class;

Constants & Global variables

NO_ERROR

NO_ERROR                   : constant := 0;
Several predefined values returned by Run

ERROR_UNEXPECTED_EXCEPTION

ERROR_UNEXPECTED_EXCEPTION : constant := 1;

INIT_EXCEPTION

INIT_EXCEPTION : exception;
This can be raised by initialization code in other packages to indicate that application initialization has failed. This exception is not raised by the Application class.

USE_ERROR

USE_ERROR : exception;
This can be raised by the application class to indicate that it is being misused. For example, calling Stop before calling Init will result in a USE_ERROR exception.

Subprograms & Entries

Create_Application

procedure Create_Application;
Forces creation of the global application without returning a reference. If the application already exists, nothing will change.

Get_Application

function Get_Application return A_Application;
Returns a reference to the global application, creating it if necessary.

Delete_Application

procedure Delete_Application;
Deletes the global application if it exists.

Terminate_Application

procedure Terminate_Application
( error: String );
Forces the application to shut down, displaying the given error message. If no Application object has been created, then the system level shutdown procedure will be called. This is only to be used in the case of a fatal error. Execution will return from this procedure, so plan accordingly.

Close

procedure Close
( this: access Application );
Closes the application after initialization. Do not call this if the application didn't successfully initialize.

Get_Company

function Get_Company
( this: not null access Application'Class ) return String;
Returns the name of the company or individual that produced this application.

Get_Name

function Get_Name
( this: not null access Application'Class ) return String;
Returns the short name of the application. This is used to determine the names of application-specific files, etc. Special characters should be avoided.

Get_Theme

function Get_Theme
( this: not null access Application'Class ) return A_Theme;
Returns the application's Theme for UI widgets.

Get_Window_Title

function Get_Window_Title
( this: not null access Application'Class ) return String;
Returns the title text at the top of the application's window if it's a graphical application.

Init (abstract)

function Init
( this: access Application ) return Boolean is abstract;
Initializes the application, returning True on success. If initialization fails, Close should not be called because whatever was partially initialized before the failure ws be finalized before returning.

Run

procedure Run
( this: access Application;
returnCode: in out Integer );
Executes the application runtime. 'returnCode' contains the numeric code that should be returned to the OS on exit. This procedure will block until Stop is called to end application execution.

Stop

procedure Stop
( this: not null access Application'Class;
errorCode: Integer := NO_ERROR );
Stops the running application. This will cause the thread that called Run to return. The value of 'errorCode' determines the value of 'returnCode' that will be returned from Run.