[Classes] [Prev] [Next] [Methods]

XVT-POWER++ CLASSES


CApplication

Methods Index

Heritage
Description
Usage
Public Data Members
Protected Data Members
Friends
Public Methods
Constructor, Destructor, and Initializer Methods
Immutable Accessor
Command Events
Menu Events
File Menu Item Events
Keyboard Events
Document Management Methods
Getting Subobjects
Environment Methods
Printing Methods
Event Handler Methods
Protected Methods

CApplication


Heritage

Superclass: CBoss

Subclasses: None


Description

Each application has one CApplication object, which is the highest object in the application framework hierarchy. This object is the first to be instantiated, the first to receive the thread of control, and the last to be destroyed. It is also the last object to receive events when no other objects can handle them. The CApplication object maintains a list of CDocument objects and creates the global desktop and global environment. CApplication is an abstract class and cannot be instantiated; you must derive an instance from it instead.


Usage

You must create a derived instance of this abstract class. There can be only one instance of CApplication within a running application. The application is normally created inside of main, as shown in the following example:

void main(int argc, char* argv[])
{
CHardHatApp testApp;
testApp.Go(argc, argv, MENU_BAR_RID, 0, "BaseName",
"Application Name", "Task Window Title");
}
Refer to the Go method for more information on each of the parameters passed in. Once the application is created and the Go method is called in the application, the Go function never returns to the user. Thus, you should set up everything before calling Go.

Typically XVT-Power++ applications close themselves when commanded by the user. The following code shows how to force the closing of an application:

if(G->GetApplication()->DoClose())
xvt_app_destroy();

Public Data Members

static BOOLEAN itIsInstantiated Assures that only one CApplication object exists; initially set to FALSE

Note: XVT-Power++ supplies this public data member so that other classes can determine application creation.


Protected Data Members

RWOrdered* itsDocuments The list of documents maintained by the application
CEnvironment* itsEnvironment; The global default environment
CSwitchBoard* itsSwitchBoard; The event handler for the application
PRINT_RCD* itsPrintRecord; The application's print record


Friends

friend class CDocument A document that can call the protected methods and add or remove itself from the application object's data member, itsDocument


Public Methods

Constructor, Destructor, and Initializer Methods

CApplication(void);
CApplication(const CApplication& theApplication);
virtual ~CApplication(void);

XVT Portability Toolkit Startup Methods

virtual void Go(int argc, char *argv[],
short theMenuBarId, short theAboutBoxId,
char *theBaseName, char *theApplicationName,
char *theTaskTitle);
virtual void StartUp(void);
virtual void ShutDown(void);

Immutable Accessor

BOOLEAN IsMultiByte() const;

Command Events

virtual void DoCommand(long theCommand, 
void* theData=NULL);

Menu Events

virtual void DoMenuCommand(MENU_TAG theMenuItem,
BOOLEAN isShiftKey, BOOLEAN isControlKey);
virtual void ChangeFont(const CFont &theFont);
virtual void SetUpMenus(CMenuBar* theMenuBar);
virtual void UpdateMenus(CMenuBar* theMenuBar);

File Menu Item Events

Each of the methods described in this section is called when the user selects an item from the File menu.

virtual void DoAboutBox(void);
virtual BOOLEAN DoClose(void);
virtual BOOLEAN DoOpen(void);
virtual BOOLEAN DoNew(void);
virtual BOOLEAN DoPageSetUp(void);
virtual BOOLEAN DoPrint(void);
virtual BOOLEAN DoSave(void);
virtual BOOLEAN DoSaveAs(void);

Keyboard Events

virtual void DoKey(const CKey&);

Document Management Methods

virtual CDocument* FindDocument(int theId) const;
virtual void CloseAll(void);
virtual int GetNumDocuments(void);
virtual RWOrdered* GetDocuments(void) const;

Getting Subobjects

virtual const RWOrdered* GetSubObjects(void) const;

Environment Methods

virtual const CEnvironment* GetEnvironment(void) const;
virtual void DoSetEnvironment(
const CEnvironment& theNewEnvironment,
BOOLEAN isUpdate = FALSE);
virtual void SetEnvironment(
const CEnvironment& theNewEnvironment);

Printing Methods

virtual PRINT_RCD* GetPrintRecord(void) const;

Event Handler Methods

virtual void DoTimer(long theTimerId);
virtual void DoUser(long theUserId, void* theData);
static BOOLEAN IsInstantiated(void);

Protected Methods

BOOLEAN IApplication(CGlobalUser *theGlobalUser);
virtual void AddDocument(CDocument *theDocument);
virtual void RemoveDocument(CDocument *theDocument);
static void SetInstantiated(BOOLEAN isInstantiated);
virtual void InstallFactories(CFactoryMgr*);


[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.