App Class Reference

The wxApp class represents the application itself. More...

Inheritance diagram for App:

EvtHandler wxObject IDisposable

List of all members.

Public Member Functions

void catchException (Object e)
virtual bool OnInit ()
virtual int OnRun ()
virtual int OnExit ()
void Run ()
void Run (char[][] args)
string VendorName ()
void VendorName (string name)
string AppName ()
void AppName (string name)
Window TopWindow ()
void TopWindow (Window window)
bool Yield ()
bool Yield (bool onlyIfNeeded)
void ExitMainLoop ()

Static Public Member Functions

static App GetApp ()
static bool SafeYield ()
static bool SafeYield (Window win)
static bool SafeYield (Window win, bool onlyIfNeeded)
static void WakeUpIdle ()

Protected Member Functions

 this ()


Detailed Description

The wxApp class represents the application itself.

It is used to:


Constructor & Destructor Documentation

this (  )  [protected]


Member Function Documentation

void catchException ( Object  e  ) 

virtual bool OnInit (  ) 

This must be provided by the application, and will usually create the application's main window, optionally calling wxApp.SetTopWindow. You may use OnExit to clean up anything initialized here, provided that the function returns true.

Notice that if you want to to use the command line processing provided by wxWidgets you have to call the base class version in the derived class OnInit().

Return true to continue processing, false to exit the application immediately.

virtual int OnRun (  ) 

This virtual function is where the execution of a program written in wxWidgets starts. The default implementation just enters the main loop and starts handling the events until it terminates, either because ExitMainLoop has been explicitly called or because the last frame has been deleted and GetExitOnFrameDelete flag is true (this is the default).

The return value of this function becomes the exit code of the program, so it should return 0 in case of successful termination.

virtual int OnExit (  ) 

Override this member function for any processing which needs to be done as the application is about to exit. OnExit is called after destroying all application windows and controls, but before wxWidgets cleanup. Note that it is not called at all if OnInit failed.

The return value of this function is currently ignored, return the same value as returned by the base class method if you override it.

static App GetApp (  )  [static]

void Run (  ) 

void Run ( char  args[][]  ) 

public string VendorName (  ) 

Returns the application's vendor name.

public void VendorName ( string  name  ) 

Sets the name of application's vendor. The name will be used in registry access. A default name is set by wxWidgets.

public string AppName (  ) 

Returns the application name.

Remarks:
wxWidgets sets this to a reasonable default before calling wxApp.OnInit, but the application can reset it at will.

public void AppName ( string  name  ) 

Sets the name of the application. The name may be used in dialogs (for example by the document/view framework). A default name is set by wxWidgets.

public Window TopWindow (  ) 

Returns a pointer to the top window.

Remarks:
If the top window hasn't been set using wxApp.SetTopWindow, this function will find the first top-level window (frame or dialog) and return that.

public void TopWindow ( Window  window  ) 

Sets the 'top' window. You can call this from within wxApp.OnInit to let wxWidgets know which is the main window. You don't have to set the top window; it is only a convenience so that (for example) certain dialogs without parents can use a specific window as the top window. If no top window is specified by the application, wxWidgets just uses the first frame or dialog in its top-level window list, when it needs to use the top window.

Parameters:
window The new top window.

static bool SafeYield (  )  [static]

static bool SafeYield ( Window  win  )  [static]

static bool SafeYield ( Window  win,
bool  onlyIfNeeded 
) [static]

bool Yield (  ) 

public bool Yield ( bool  onlyIfNeeded  ) 

Yields control to pending messages in the windowing system. This can be useful, for example, when a time-consuming process writes to a text window. Without an occasional yield, the text window will not be updated properly, and on systems with cooperative multitasking, such as Windows 3.1 other processes will not respond.

Caution should be exercised, however, since yielding may allow the user to perform actions which are not compatible with the current task. Disabling menu items or whole menus during processing can avoid unwanted reentrance of code: see wxSafeYield for a better function.

Note that Yield() will not flush the message logs. This is intentional as calling Yield() is usually done to quickly update the screen and popping up a message box dialog may be undesirable. If you do wish to flush the log messages immediately (otherwise it will be done during the next idle loop iteration), call wxLog.FlushActive.

Calling Yield() recursively is normally an error and an assert failure is raised in debug build if such situation is detected. However if the onlyIfNeeded parameter is true, the method will just silently return false instead.

static void WakeUpIdle (  )  [static]

void ExitMainLoop (  ) 


The documentation for this class was generated from the following files:
Generated on Sun Feb 1 21:30:22 2009 for wxD by  doxygen 1.5.4