class PApplication: PAPPLICATION_ANCESTOR

A class to embody a GUI application.

Inheritance:


Public Classes

[more]enum ParameterTypes
This enum describes the possible parameter list types that may be passed to the application.

Public Methods

[more] PApplication ( const char * manuf = "", const char * name = "", WORD majorVersion = 1, WORD minorVersion = 0, CodeStatus status = ReleaseCode, WORD buildNumber = 1 )
Create a new application instance.
[more] ~PApplication ()
Destroy the application
[more]virtual void Main ()
This is the windows application main event loop.
[more]virtual void Terminate ()
Terminate the application.
[more]static PApplication& Current ()
Get the current processes application object.
[more]virtual void PassMainLoop ()
This function is called in the main program execution loop for handling events.
[more]PTopLevelWindow* GetWindow () const
Get the top level window for the application.
[more]ParameterTypes GetParameterType () const
Get the type of the parameter list.
[more]void SetAboutMenuItemString ( const PString & newName )
Set the menu item string to be used in the system standard Äbout" menu item.
[more]PString GetAboutMenuItemString () const
Get the menu item string to be used in the system standard Äbout" menu item.
[more]void SetAboutDialogID ( PRESOURCE_ID newID )
Set the resource ID to be used in the OnAbout() function.
[more]PRESOURCE_ID GetAboutDialogID () const
Get the resource ID to be used in the OnAbout() function.
[more]virtual void OnAbout ()
Function which gets called when the about menu item is selected.
[more]void SetDefaultHelpFile ( const PFilePath & name )
Set the default help file for the application.
[more]PFilePath GetDefaultHelpFile () const
Set the default help file for the application.
[more]void DoContextHelp ( const PString & context )
Execute context sensitive help with the specified context key and help file.
[more]PBalloon* DoBalloonHelp ( PInteractor * interactor, int action = 0 )
Do all logic regarding the inflation and deflation of balloon help.
[more]PInteractor* FindInteractor ( const PPoint & pt ) const
Find the interactor that is at the specified absolute screen coordinates.
[more]const PRect& GetScreenRect () const
Get the size of the screen in pixels.
[more]const PDim& GetPrimaryScreenSize () const
Get the size of the primary screen in pixels.
[more]const PDim& GetScreenResolution ( BOOL imperial = FALSE ) const
Get the resolution for the screen.
[more]long GetScreenColours () const
Get the number of colours that can be simultaneously be displayed on the screen.
[more]PDIMENSION GetScreenDepth () const
Get the number of bits per pixel that the screen is capable of.
[more]const PDim& GetCursorSize () const
Get the maximum size of a cursor pixmap in screen pixels.
[more]const PDim& GetIconSize () const
Get the maximum size of an icon pixmap in screen pixels.
[more]PDIMENSION GetTitleHeight () const
Get the height of the caption part of a titled window or descendent.
[more]PDIMENSION GetMenuHeight () const
Get the height of the menu bar in PTopLevelWindow descendent classes.
[more]const PDim& GetTitledBorderSize () const
Get the size of the border for a titled window ie one that may be moved & resized.
[more]const PDim& GetDlgBorderSize () const
Get the size of the border for a modal dialog box.
[more]const PDim& GetBorderSize () const
Get the size of the border for interactors with borders other than modal dialogs and resizable windows.
[more]const PDim& GetMainWindowSize () const
Get the default size of a main (top level) window.
[more]const PDim& GetTitledWindowSize () const
Get the default size of all titled windows other than top level windows.
[more]PDIMENSION GetHScrollHeight () const
Get the size of the horizontal scroll bar.
[more]PDIMENSION GetVScrollWidth () const
Get the size of the vertical scroll bar.
[more]const PFont& GetSystemFont () const
Get the system font which is the default basis for interactor coordinate systems.
[more]const PFont& GetBalloonFont () const
Get the font which is the default basis for balloon help windows.
[more]const PRect& GetDoubleClickRect () const
Get the rectangle around a mouse click point that the second click must be within to be detected as a double click.
[more]const PTimeInterval& GetDoubleClickTime () const
Get the amount of milliseconds that must not have elapsed for the two mouse clicks to called a double click.
[more]const PColour& GetWindowFgColour () const
Get the default colour of all foreground items in interactors.
[more]const PColour& GetWindowBkColour () const
Get the default colour of all background items in interactors.
[more]const PColour& GetActiveBorderColour () const
Get the default colour of active titled window border.
[more]const PColour& GetInactiveBorderColour () const
Get the default colour of inactive titled window border.
[more]const PColour& GetActiveTitleFgColour () const
Get the default colour of the window title text in an active window.
[more]const PColour& GetActiveTitleBkColour () const
Get the default colour of the window title bar in an active window.
[more]const PColour& GetInactiveTitleFgColour () const
Get the default colour of the window title text in an inactive window.
[more]const PColour& GetInactiveTitleBkColour () const
Get the default colour of the window title bar in an inactive window.
[more]const PColour& GetMenuFgColour () const
Get the default colour of the text in menus or menu bar.
[more]const PColour& GetMenuBkColour () const
Get the default colour of the background in menus or menu bar.
[more]const PColour& GetBalloonFgColour () const
Get the default colour of the text in balloon help windows.
[more]const PColour& GetBalloonBkColour () const
Get the default colour of the background in balloon help windows.
[more]const PColour& GetButtonFgColour () const
Get the default colour of the foreground (text) in a standard 3 dimensional push button.
[more]const PColour& GetButtonBkColour () const
Get the default colour of the background (face) in a standard 3 dimensional push button.
[more]const PColour& GetButtonLightingColour () const
Get the default colour of the lighted edge in a standard 3 dimensional push button.
[more]const PColour& GetButtonShadowColour () const
Get the default colour of the shadowed edge in a standard 3 dimensional push button.
[more]const PColour& GetScrollBarColour () const
Get the default colour of the slider section of a scroll bar.
[more]const PColour& GetHighlightFgColour () const
Get the default colour of text that is highlighted.
[more]const PColour& GetHighlightBkColour () const
Get the default colour of the background for text that is highlighted.
[more]const PColour& GetGrayTextColour () const
Get the default colour of text that is disabled ("dimmed" or "grayed out").
[more]void DelayedCloseInteractor ( PInteractor * interactor )
Add the interactor to the list for delayed delete operation on close of interactor from within a callback member function.

Public

[more] Overrides from class PProcess
[more] New functions for class

Protected Fields

[more]PTopLevelWindow* mainWindow
The main, top level window for the application.
[more]ParameterTypes parameterType
The type of the parameter list.


Documentation

A class to embody a GUI application. There is always exactly one instance of a descendednt of this class in an application. It should be possible to write the application so that this is the only global variable present. All other data is contained within this instance or its member variables or their member variables etc.
o PApplication( const char * manuf = "", const char * name = "", WORD majorVersion = 1, WORD minorVersion = 0, CodeStatus status = ReleaseCode, WORD buildNumber = 1 )
Create a new application instance.
Parameters:
manuf - Name of manufacturer
name - Name of product
majorVersion - Major version number of the product
minorVersion - Minor version number of the product
status - Development status of the product
buildNumber - Build number of the product

o ~PApplication()
Destroy the application

o Overrides from class PProcess

ovirtual void Main()
This is the windows application main event loop. A typical application would override this function to perform all application initialisation and then call the ancestor function to execute the event loop.

ovirtual void Terminate()
Terminate the application. This will destroy the main window and exit the event loop in Main(). This is usually only used in abnormal abort situations.

o New functions for class

ostatic PApplication& Current()
Get the current processes application object. Note that there can only be one instance of an application class in a program image.

Returns:
Pointer to the current application.

ovirtual void PassMainLoop()
This function is called in the main program execution loop for handling events. This may be overridden to allow operations to be handled after each event that is handled by the system.

oPTopLevelWindow* GetWindow() const
Get the top level window for the application. This will be the first instance of a descendent from PTopLevelWindow.

Returns:
pointer to the top level window for the application.

oenum ParameterTypes
This enum describes the possible parameter list types that may be passed to the application. The mechanism by which these are passed is platform dependent.

o OpenFiles
The parameters are a list of files to be opened

o PrintFiles
The parameters are a list of files to be printed

o GeneralParameters
The parameters are arbitrary strings

oParameterTypes GetParameterType() const
Get the type of the parameter list. The ParameterTypes values indicate that the parameter list should be parsed as a set of files to be opened or printed, or in the GeneralParameters case it leaves it entirely up to the application to decide what to do. In this case they may be parsed by the PArgList class.

Returns:
type of the application arguments

ovoid SetAboutMenuItemString( const PString & newName )
Set the menu item string to be used in the system standard Äbout" menu item. This string is used whenever the SetMenu() function is executed on a PTopLevelWindow class.
Parameters:
newName - New menu item title for the Äbout" function

oPString GetAboutMenuItemString() const
Get the menu item string to be used in the system standard Äbout" menu item. This string is used whenever the SetMenu() function is executed on a PTopLevelWindow class.

Returns:
string used for Äbout" menus.

ovoid SetAboutDialogID( PRESOURCE_ID newID )
Set the resource ID to be used in the OnAbout() function.
Parameters:
newID - New resource ID for the Äbout" dialog.

oPRESOURCE_ID GetAboutDialogID() const
Get the resource ID to be used in the OnAbout() function.

Returns:
Resource ID for Äbout" dialog.

ovirtual void OnAbout()
Function which gets called when the about menu item is selected. An application could override this function to display a fancy Äbout" dialog.

The default behaviour is to display the dialog specified by the SetAboutDialogID() function. If this dialog has not been set then a PSimpleDialog with the manufacturer, program name and version is displayed.

ovoid SetDefaultHelpFile( const PFilePath & name )
Set the default help file for the application. This file is used by the DoContextHelp() function in this class.
Parameters:
name - Name of help file to be used by application.

oPFilePath GetDefaultHelpFile() const
Set the default help file for the application. This file is used by the DoContextHelp() function in this class.

Returns:
Name of help file to be used by application.

ovoid DoContextHelp( const PString & context )
Execute context sensitive help with the specified context key and help file. This will start the platform standard help system to display the help information for the context.
Parameters:
context - Context string index into the help file

oPBalloon* DoBalloonHelp( PInteractor * interactor, int action = 0 )
Do all logic regarding the inflation and deflation of balloon help. The action parameter indicates the action to take in the balloon help system.

A zero value for action indicates that the mouse was moved over the indicated interactor and if it stops moving, a balloon popup is to be displayed.

A value for action of one indicates that current balloon is to be set to the

A value for action of two indicates that current balloon is to be returned and no other action taken.

This is an internal function and is not normally called by the application.

Returns:
The balloon window displayed.
Parameters:
interactor - Interactor in which cursor is over.
action - Action to take in the balloon help system.

oPInteractor* FindInteractor( const PPoint & pt ) const
Find the interactor that is at the specified absolute screen coordinates. The interactor must be owned by the application.

Returns:
pointer to interactor at point or NULL if no interactor there.
Parameters:
pt - Point to check.

oconst PRect& GetScreenRect() const
Get the size of the screen in pixels. Note that on some platforms the "screen" may be made up of smaller screens next to each other, and is not actually rectangular. In this case it returns the largest bounding rectangle of all sub-screens.

Returns:
the coordiantes of the screen in pixels.

oconst PDim& GetPrimaryScreenSize() const
Get the size of the primary screen in pixels. This is always the screen that has its origin at 0,0 in multi screen systems.

Returns:
the coordiantes of the screen in pixels.

oconst PDim& GetScreenResolution( BOOL imperial = FALSE ) const
Get the resolution for the screen.

Returns:
dots per meter (or inch) in x and y for the screen.
Parameters:
imperial - Indicate that the return value is in imperial (TRUE) or metric (FALSE)

olong GetScreenColours() const
Get the number of colours that can be simultaneously be displayed on the screen.

Returns:
number of colours.

oPDIMENSION GetScreenDepth() const
Get the number of bits per pixel that the screen is capable of.

Returns:
the depth or number of bits per pixel.

oconst PDim& GetCursorSize() const
Get the maximum size of a cursor pixmap in screen pixels.

Returns:
width & height of a cursor.

oconst PDim& GetIconSize() const
Get the maximum size of an icon pixmap in screen pixels.

Returns:
width & height of an icon.

oPDIMENSION GetTitleHeight() const
Get the height of the caption part of a titled window or descendent. This may also be used on PDialog descendents on some platforms.

Returns:
height in pixels of caption.

oPDIMENSION GetMenuHeight() const
Get the height of the menu bar in PTopLevelWindow descendent classes.

Returns:
height in pixels of the menu bar.

oconst PDim& GetTitledBorderSize() const
Get the size of the border for a titled window ie one that may be moved & resized.

Returns:
width & height in pixels of the border.

oconst PDim& GetDlgBorderSize() const
Get the size of the border for a modal dialog box.

Returns:
width & height in pixels of the border.

oconst PDim& GetBorderSize() const
Get the size of the border for interactors with borders other than modal dialogs and resizable windows.

Returns:
width & height in pixels of the border.

oconst PDim& GetMainWindowSize() const
Get the default size of a main (top level) window.

Returns:
width & height in pixels of the window.

oconst PDim& GetTitledWindowSize() const
Get the default size of all titled windows other than top level windows.

Returns:
width & height in pixels of the window.

oPDIMENSION GetHScrollHeight() const
Get the size of the horizontal scroll bar.

Returns:
height in pixels of the scroll bar.

oPDIMENSION GetVScrollWidth() const
Get the size of the vertical scroll bar.

Returns:
width in pixels of the scroll bar.

oconst PFont& GetSystemFont() const
Get the system font which is the default basis for interactor coordinate systems. This is also the initial font used in interactors which will be active when drawing into canvases.

Returns:
specification of the system font.

oconst PFont& GetBalloonFont() const
Get the font which is the default basis for balloon help windows.

Returns:
specification of the font.

oconst PRect& GetDoubleClickRect() const
Get the rectangle around a mouse click point that the second click must be within to be detected as a double click. Typically you would do a PtInRect of the second click position within this rectangle that has been offset by the position of the first click.

Returns:
rectangle for double click bounds.

oconst PTimeInterval& GetDoubleClickTime() const
Get the amount of milliseconds that must not have elapsed for the two mouse clicks to called a double click.

Returns:
time interval for double click.

oconst PColour& GetWindowFgColour() const
Get the default colour of all foreground items in interactors.

Returns:
colour specification.

oconst PColour& GetWindowBkColour() const
Get the default colour of all background items in interactors.

Returns:
colour specification.

oconst PColour& GetActiveBorderColour() const
Get the default colour of active titled window border.

Returns:
colour specification.

oconst PColour& GetInactiveBorderColour() const
Get the default colour of inactive titled window border.

Returns:
colour specification.

oconst PColour& GetActiveTitleFgColour() const
Get the default colour of the window title text in an active window.

Returns:
colour specification.

oconst PColour& GetActiveTitleBkColour() const
Get the default colour of the window title bar in an active window.

Returns:
colour specification.

oconst PColour& GetInactiveTitleFgColour() const
Get the default colour of the window title text in an inactive window.

Returns:
colour specification.

oconst PColour& GetInactiveTitleBkColour() const
Get the default colour of the window title bar in an inactive window.

Returns:
colour specification.

oconst PColour& GetMenuFgColour() const
Get the default colour of the text in menus or menu bar.

Returns:
colour specification.

oconst PColour& GetMenuBkColour() const
Get the default colour of the background in menus or menu bar.

Returns:
colour specification.

oconst PColour& GetBalloonFgColour() const
Get the default colour of the text in balloon help windows.

Returns:
colour specification.

oconst PColour& GetBalloonBkColour() const
Get the default colour of the background in balloon help windows.

Returns:
colour specification.

oconst PColour& GetButtonFgColour() const
Get the default colour of the foreground (text) in a standard 3 dimensional push button.

Returns:
colour specification.

oconst PColour& GetButtonBkColour() const
Get the default colour of the background (face) in a standard 3 dimensional push button.

Returns:
colour specification.

oconst PColour& GetButtonLightingColour() const
Get the default colour of the lighted edge in a standard 3 dimensional push button.

Returns:
colour specification.

oconst PColour& GetButtonShadowColour() const
Get the default colour of the shadowed edge in a standard 3 dimensional push button.

Returns:
colour specification.

oconst PColour& GetScrollBarColour() const
Get the default colour of the slider section of a scroll bar. The arrows and thumb use the colours of the standard pushbutton.

Returns:
colour specification.

oconst PColour& GetHighlightFgColour() const
Get the default colour of text that is highlighted. Used in the menus menu bars and edit text controls.

Returns:
colour specification.

oconst PColour& GetHighlightBkColour() const
Get the default colour of the background for text that is highlighted. Used in the menus, menu bars and edit text controls.

Returns:
colour specification.

oconst PColour& GetGrayTextColour() const
Get the default colour of text that is disabled ("dimmed" or "grayed out"). Used in the menus, menu bars and all controls.

Returns:
colour specification.

ovoid DelayedCloseInteractor( PInteractor * interactor )
Add the interactor to the list for delayed delete operation on close of interactor from within a callback member function. This avoids the problem of an interactor object having its memory freed (via delete) while executing member functions of that object. The actual delete operation is delayed until the system returns to the main event loop.

This function is primarily for internal use by PWLib and is used by the Close() function in the PTitledWindow and PDialog classes.

Parameters:
interactor - Interactor to close

oPTopLevelWindow* mainWindow
The main, top level window for the application.

oParameterTypes parameterType
The type of the parameter list.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.