Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::AbstractApplication Class Reference

An AbstractApplication is a base class for deriving new application types Currently there are two main types, standard Application classes, which represent the current process the application is associated with and of which there should only be one, and LibraryApplication classes which are tied to shared librarys or DLL's. More...

#include <vcf/ApplicationKit/AbstractApplication.h>

Inheritance diagram for VCF::AbstractApplication:

VCF::ObjectWithEvents VCF::Object VCF::Application VCF::LibraryApplication VCF::DocumentBasedApplication< DocInterfacePolicy > VCF::UIApplication List of all members.

Public Member Functions

 AbstractApplication ()
virtual ~AbstractApplication ()
String getName ()
 allows for the use of programmable, user friendly names for Applications
virtual void setName (const String &name)
virtual bool initRunningApplication ()=0
 This happens after the Application object is constructed, after the initialize() method, and just before the app's run() method is called successful.
virtual void terminateRunningApplication ()=0
 terminates the running application.
ApplicationPeergetPeer ()
 retreives the system specific Peer for this application
virtual GraphicsResourceBundlegetResourceBundle ()
 This returns the application's resource bundle.
String getFileName ()
 returns the full path for the application executable
WindowcreateWindow (Class *windowClass)
 Creates a Frame from a frame derived class name.
DialogcreateDialog (Class *dialogClass)
void loadWindow (Window *window)
 Loads an already existing Frame from a frame derived class name.
void loadDialog (Dialog *dialog)
virtual void idleTime ()
 This virtual function is called during the event loops idle phase.
virtual void postEvent (EventHandler *eventHandler, Event *event, const bool &deleteHandler=true)
 call this method to post an event.
AcceleratorKeygetAccelerator (const VirtualKeyCode &keyCode, const uint32 &modifierMask, Object *src)
void addAcceleratorKey (const VirtualKeyCode &keyCode, const uint32 &modifierMask, EventHandler *eventHandler)
void addAcceleratorKey (AcceleratorKey *accelerator)

Protected Attributes

ApplicationPeerapplicationPeer_
String applicationName_

Detailed Description

An AbstractApplication is a base class for deriving new application types Currently there are two main types, standard Application classes, which represent the current process the application is associated with and of which there should only be one, and LibraryApplication classes which are tied to shared librarys or DLL's.

An application can act as a grouping place for a set of logically connect group of behaviours. For example, you might consider writing an HTML editor and thus want to create an HTMLEditorApplication class. Later you might expand things and break out the text editing functionality into a separate library, thus create a TextEditorLibraryApplication class. You would still have a primary application class ( the HTMLEditorApplication ) of which there could be only one per process. However, unlike other frameworks, an AbstractApplication instance is NOT a requirement in the VCF. It is entirely possible to use the VCF without an application object. For example, you may have an existing MFC or raw Win32 application that you wish to enhance using controls or other classes from the VCF. To allow this certain functions are declared again in the AbstractApplication class that were previously declared in the UIToolkit to allow for a central place to call them when using an application object, but still allowing the framework to operate correctly without the application instance when appropriate. Please note that while these functions may be declared again, they are not reimplmented. All the AbstractApplication functions like postEvent() or getAccelerator() do is to call the approriate UIToolkit functions, so no implmentation code is duplicated.


Constructor & Destructor Documentation

VCF::AbstractApplication::AbstractApplication  ) 
 

virtual VCF::AbstractApplication::~AbstractApplication  )  [virtual]
 


Member Function Documentation

void VCF::AbstractApplication::addAcceleratorKey AcceleratorKey accelerator  ) 
 

void VCF::AbstractApplication::addAcceleratorKey const VirtualKeyCode keyCode,
const uint32 modifierMask,
EventHandler eventHandler
 

Dialog* VCF::AbstractApplication::createDialog Class dialogClass  ) 
 

Window* VCF::AbstractApplication::createWindow Class windowClass  ) 
 

Creates a Frame from a frame derived class name.

Parameters:
String the name of the frame derived class name this is also the name of the VFF (Visual Form File) resource which is loaded. If this can't be found or the class name doesn't exist in the ClassRegistry then the return is NULL.
Returns:
Frame a pointer to new instance of the type specified in the frameClassName argument. NULL if the form resource doesn't exist or the class doesn't exist. Otherwise it represent a full loaded instance, using the data from the resource VFF.

AcceleratorKey* VCF::AbstractApplication::getAccelerator const VirtualKeyCode keyCode,
const uint32 modifierMask,
Object src
 

String VCF::AbstractApplication::getFileName  ) 
 

returns the full path for the application executable

Returns:
String the fully qualified path to the executable that the Application represents.
for example:
		String appFileName = Application::getRunningInstance()->getFileName();
		Sting msg = StringUtils::formatString( "The app file name is: %s", appFileName.c_str() );
		Dialog::showMessage( msg );
	*

String VCF::AbstractApplication::getName  )  [inline]
 

allows for the use of programmable, user friendly names for Applications

ApplicationPeer* VCF::AbstractApplication::getPeer  ) 
 

retreives the system specific Peer for this application

Returns:
ApplicationPeer - the application Peer
See also:
ApplicationPeer

virtual GraphicsResourceBundle* VCF::AbstractApplication::getResourceBundle  )  [virtual]
 

This returns the application's resource bundle.

If the application in question is the application instance that represents the running process/program ( in other words, the instance returned by Application::getRunningInstance() ) then the resource bundle returned is the same that you would get by calling System::getResourceBundle(). However, if the application instance is a LibraryApplication, then the resource bundle is unique to that library, and independant from that of the main application's resource bundle.

This is re-implemented in LibraryApplication class.

Reimplemented in VCF::LibraryApplication.

virtual void VCF::AbstractApplication::idleTime  )  [virtual]
 

This virtual function is called during the event loops idle phase.

Ovveride this fucntion for application specific processing that can be done during idle time.

virtual bool VCF::AbstractApplication::initRunningApplication  )  [pure virtual]
 

This happens after the Application object is constructed, after the initialize() method, and just before the app's run() method is called successful.

if false, it calls terminate() and then kills the app process. this method also builds the accellerator table used for keyboard shortcuts

Returns:
bool this tells whether or not the initialization of the application was

Implemented in VCF::Application, VCF::DocumentBasedApplication< DocInterfacePolicy >, and VCF::LibraryApplication.

void VCF::AbstractApplication::loadDialog Dialog dialog  ) 
 

void VCF::AbstractApplication::loadWindow Window window  ) 
 

Loads an already existing Frame from a frame derived class name.

Parameters:
Frame a pointer to new instance of the type specified in the frameClassName argument.

virtual void VCF::AbstractApplication::postEvent EventHandler eventHandler,
Event event,
const bool &  deleteHandler = true
[virtual]
 

call this method to post an event.

You can override it ot provide extra behaviour. The default behaviour is to simply pass the event along to the UIToolkit::postEvent() method. The idea in placing this function here is allow event posting to be able to happen through an application where appropriate.

See also:
UIToolkit::postEvent()

virtual void VCF::AbstractApplication::setName const String name  )  [virtual]
 

Reimplemented in VCF::LibraryApplication.

virtual void VCF::AbstractApplication::terminateRunningApplication  )  [pure virtual]
 

terminates the running application.

This is called during normal shutdown of an application object. You should override this function if your application created resources and release those resources here.

Implemented in VCF::Application, VCF::DocumentBasedApplication< DocInterfacePolicy >, and VCF::LibraryApplication.


Member Data Documentation

String VCF::AbstractApplication::applicationName_ [protected]
 

ApplicationPeer* VCF::AbstractApplication::applicationPeer_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information