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

VCF::Application Class Reference

Represents the main process for a application. More...

#include <vcf/ApplicationKit/Application.h>

Inheritance diagram for VCF::Application:

VCF::AbstractApplication VCF::Component VCF::ObjectWithCallbacks VCF::Object VCF::DocumentBasedApplication< DocInterfacePolicy > VCF::UIApplication List of all members.

Public Member Functions

 Application (int argc, char **argv)
 Every derived class must at least take argc, and argv arguments to it's constructor.
virtual ~Application ()
void run ()
 starts the application event loop running
virtual bool initRunningApplication ()
 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 ()
 terminates the running application
WindowgetMainWindow ()
 gets the main window of the application.
void setMainWindow (Window *mainWindow)
 sets the main window for the application
void onMainWindowClose (WindowEvent *event)
 event handler for the main window closing down.
void loadVPL (const String &vplFileName)
 load a VPL, calls the initPackage() function, and adds the library to it's list.
virtual bool loadState ()
virtual bool saveState ()
virtual bool loadFrameState (Frame *frame)
virtual bool saveFrameState (Frame *frame)
void setAutoLoadSaveAppState (const bool &autoLoadSaveState)
virtual bool displayHelpContents ()
 This gets called by the internals of the framework in response standard OS events.
virtual bool displayHelpIndex ()
 This gets called by the internals of the framework in response standard OS events.
virtual void getHelpInfo (String &helpBookName, String &helpDirectory)
 returns the values for the help book and the directory it's located in.
virtual void onOSNativeEvent (Event *nativeOSEvent)
 default implamentation simply passes the event to the Delegate to be passed off to any other EventHandlers.
bool isSingleInstance () const
void setSingleInstance (bool val)
virtual void processCommandLine (const CommandLine &comdLine)

Static Public Member Functions

static int main ()
 The entry point into the application object starting up.
static ApplicationgetRunningInstance ()
 returns the singleton instance of the current application for this process.
static void showErrorMessage (const String &message, const String &title)
static bool showAssertMessage (const String &message, const String &title)

Public Attributes

OSEventReceivedDelegate nativeOSEventReceived
 Use this delegate to attach an event handler for native OS Events.

Protected Member Functions

void init ()
void internal_terminate ()

Static Protected Member Functions

static void internal_main ()

Protected Attributes

std::map< String, Library * > VPLMap_
bool autoLoadSaveAppState_

Static Protected Attributes

static ApplicationappInstance_

Detailed Description

Represents the main process for a application.

Each application contains a main window, pointed to by mainWindow_. Application are started by some entry point of the executing process. Once the entry point has been called, usually main(), the static function Application::appMain() is called to start the application initializing itself. While the Application instance is optional, if it is present there should only be one instance that is created on the stack.

Typically the startup code looks like this:

 int main( int argc, char** argv ) {
        Application theApp(argc, argv);

        Application::main();

        return 0;
  }
 *

Version:
1.0
Author:
Jim Crafton
Event Delegates for this class:


Constructor & Destructor Documentation

VCF::Application::Application int  argc,
char **  argv
 

Every derived class must at least take argc, and argv arguments to it's constructor.

These in turn get passed to the ApplicationKit and it's underlying platform implementation in order to properly initialize them. These arguments can be retrieved in the form of the CommandLine instance that is part of the FoundationKit. For example:

    CommandLine cmdLine =  FoundationKit::getCommandLine();
    //get the first argument
    cmdLine.getArgument(0);

See also:
CommandLine

virtual VCF::Application::~Application  )  [virtual]
 


Member Function Documentation

virtual bool VCF::Application::displayHelpContents  )  [virtual]
 

This gets called by the internals of the framework in response standard OS events.

You can customize how or what help contents are loaded by overriding this function.

Returns:
bool returns true if this function handles the help message. Otherwise it returns false, in which case the framework handles the rest. The default behaviour is to return false.

virtual bool VCF::Application::displayHelpIndex  )  [virtual]
 

This gets called by the internals of the framework in response standard OS events.

You can customize how or what help index is loaded by overriding this function.

Returns:
bool returns true if this function handles the help message. Otherwise it returns false, in which case the framework handles the rest. The default behaviour is to return false.

virtual void VCF::Application::getHelpInfo String helpBookName,
String helpDirectory
[virtual]
 

returns the values for the help book and the directory it's located in.

The default returns empty strings for both values.

Window* VCF::Application::getMainWindow  ) 
 

gets the main window of the application.

All applications have a main window of some sort. This can a be a tool type window, a dialog, or just a regular window. When this window is closed, the application begins it's shutdown priocess

Returns:
Window* the main window

static Application* VCF::Application::getRunningInstance  )  [static]
 

returns the singleton instance of the current application for this process.

May be null if the VCF is being used without Application support.

Returns:
Application the single instance for this process. Do not assume it will be non NULL.

void VCF::Application::init  )  [protected]
 

virtual bool VCF::Application::initRunningApplication  )  [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

Implements VCF::AbstractApplication.

Reimplemented in VCF::DocumentBasedApplication< DocInterfacePolicy >.

static void VCF::Application::internal_main  )  [static, protected]
 

void VCF::Application::internal_terminate  )  [protected]
 

bool VCF::Application::isSingleInstance  )  const [inline]
 

virtual bool VCF::Application::loadFrameState Frame frame  )  [virtual]
 

virtual bool VCF::Application::loadState  )  [virtual]
 

void VCF::Application::loadVPL const String vplFileName  ) 
 

load a VPL, calls the initPackage() function, and adds the library to it's list.

The library will be unloaded when the app quits.

static int VCF::Application::main  )  [static]
 

The entry point into the application object starting up.

void VCF::Application::onMainWindowClose WindowEvent event  ) 
 

event handler for the main window closing down.

virtual void VCF::Application::onOSNativeEvent Event nativeOSEvent  )  [inline, virtual]
 

default implamentation simply passes the event to the Delegate to be passed off to any other EventHandlers.

To prevent this from happening, do NOT call the base class's onOSNativeEvent()

Parameters:
Event this instance has in it's UserData a pointer to a wrapper struct. For Win32 systems please see the Win32Toolkit.h and look at the Win32MSG class. This will wrap up a MSG struct that you can use.
Example (this is pertinent ONLY to Win32 systems):
        void MyApp::onOSNativeEvent( Event* e )
        {
            //comment the next line out if you want to prevent the
            //delegate from notifying event handlers
            Application::onOSNativeEvent(e);

            Win32MSG* msg = (Win32MSG*)e->getUserData();

            switch( msg->msg_.message ) {
                //do whatever here
            }
        }

virtual void VCF::Application::processCommandLine const CommandLine comdLine  )  [inline, virtual]
 

Reimplemented in VCF::DocumentBasedApplication< DocInterfacePolicy >.

void VCF::Application::run  ) 
 

starts the application event loop running

virtual bool VCF::Application::saveFrameState Frame frame  )  [virtual]
 

virtual bool VCF::Application::saveState  )  [virtual]
 

void VCF::Application::setAutoLoadSaveAppState const bool &  autoLoadSaveState  ) 
 

void VCF::Application::setMainWindow Window mainWindow  ) 
 

sets the main window for the application

void VCF::Application::setSingleInstance bool  val  ) 
 

static bool VCF::Application::showAssertMessage const String message,
const String title
[static]
 

static void VCF::Application::showErrorMessage const String message,
const String title
[static]
 

virtual void VCF::Application::terminateRunningApplication  )  [virtual]
 

terminates the running application

Implements VCF::AbstractApplication.

Reimplemented in VCF::DocumentBasedApplication< DocInterfacePolicy >.


Member Data Documentation

Application* VCF::Application::appInstance_ [static, protected]
 

bool VCF::Application::autoLoadSaveAppState_ [protected]
 

OSEventReceivedDelegate VCF::Application::nativeOSEventReceived
 

Use this delegate to attach an event handler for native OS Events.

Event Delegate:
ToolTip fires an ControlEvent.
event class: Event

std::map<String,Library*> VCF::Application::VPLMap_ [protected]
 


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