The wxApp class represents the application itself.
wxApp::wxApp
wxApp::~wxApp
wxApp::argc
wxApp::argv
wxApp::wx_class
wxApp::work_proc
wxApp::Dispatch
wxApp::GetAppName
wxApp::GetClassName
wxApp::GetExitOnDelete
wxApp::GetPrintMode
wxApp::GetTopWindow
wxApp::ExitMainLoop
wxApp::Initialized
wxApp::MainLoop
wxApp::OnExit
wxApp::OnCharHook
wxApp::OnInit
wxApp::Pending
wxApp::ProcessMessage
wxApp::SetAppName
wxApp::SetClassName
wxApp::SetExitOnDelete
wxApp::SetPrintMode
void wxApp(int language = wxLANGUAGE_ENGLISH)
Constructor. Called implicitly with a definition of a wxApp object.
The argument is a language identifier; this is an experimental feature and will be expanded and documented in future versions.
void ~wxApp(void)
Destructor. Will be called implicitly on program exit if the wxApp object is created on the stack.
int argc
Number of command line arguments (after environment-specific processing).
char ** argv
Command line arguments (after environment-specific processing).
char * wx_class
Currently used under Motif only, where the value is passed to XtOpenDisplay on initialization. Set this member in the constructor of your derived wxApp class to give the application a name other than the default "wxApp''.
void * work_proc
Set this member to the address of a function that takes a pointer to wxApp. It will be called whenever the system is idle and can be used to schedule background tasks.
void Dispatch(void)
Dispatches the next event in the windowing system event queue. (MS Windows and Motif). See also wxApp::Pending.
This can be used for programming event loops, e.g.
while (app.Pending()) Dispatch();
char * GetAppName(void)
Returns the application name. wxWindows sets this to a reasonable default before calling wxApp::OnInit, but the application can reset it at will.
char * GetClassName(void)
Gets the class name of the application. The class name may be used in a platform specific manner to refer to the application.
Bool GetExitOnDelete(void)
Returns TRUE if the application will exit when the top-level window is deleted, FALSE otherwise.
Bool GetPrintMode(void)
Returns the print mode: see SetPrintMode.
wxWindow * GetTopWindow(void)
Returns a pointer to the top window (as returned by wxApp::OnInit). This may return NULL if called before the end of wxApp::OnInit.
void ExitMainLoop(void)
Call this to explicitly exit the main message (event) loop. You should normally exit the main loop (and the application) by deleting the frame returned from wxApp::OnInit.
Bool Initialized(void)
Returns TRUE if the application has been initialized (i.e. if OnInit has returned successfully). This can be useful for error message routines to determine which method of output is best for the current state of the program (some windowing systems may not like dialogs to pop up before the main loop has been entered).
int MainLoop(void)
Called by wxWindows on creation of the application. Override this if you wish to provide your own (environment-dependent) main loop.
Returns 0 under X, and the wParam of the WM_QUIT message under Windows.
int OnExit(void)
Provide this member function for any processing which needs to be done as the application is about to exit.
Bool OnCharHook(wxKeyEvent& ch)
This member is called (under Windows only) to allow the window to intercept keyboard events before they are processed by child windows. The default implementation forwards the message to the currently active window. The function should returns TRUE to indicate the character has been processed, or FALSE to allow default processing.
See also wxKeyEvent, wxEvtHandler::OnChar, wxEvtHandler::OnCharHook, wxDialogBox::OnCharHook.
wxFrame * OnInit(void)
This must be provided by the application, and must create and return the application's main window.
Bool Pending(void)
Returns TRUE if unprocessed events are in the window system event queue (MS Windows and Motif). See also wxApp::Dispatch.
Bool ProcessMessage(MSG *msg)
Windows-only function for processing a message. This function is called from the main message loop, checking for windows that may wish to process it. The function returns TRUE if the message was processed, FALSE otherwise. If you use wxWindows with another class library with its own message loop, you should make sure that this function is called to allow wxWindows to receive messages. For example, to allow co-existance with the Microsoft Foundation Classes, override the PreTranslateMessage function:
// Provide wxWindows message loop compatibility BOOL CTheApp::PreTranslateMessage(MSG *msg) { if (wxTheApp && wxTheApp->ProcessMessage(msg)) return TRUE; else return CWinApp::PreTranslateMessage(msg); }
void SetAppName(char *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 wxWindows.
void SetClassName(char *name)
Sets the class name of the application. This may be used in a platform specific manner to refer to the application.
void SetExitOnDelete(Bool flag)
If flag is TRUE (the default), the application will exit when the top-level frame is deleted. If FALSE, the application will continue to run.
Currently, setting this to FALSE only has an effect under Windows.
void SetPrintMode(int mode)
Sets the print mode determining what printing facilities will be used by the printing framework.