1 \section{\class{wxApp
}}\label{wxapp
}
3 The
{\bf wxApp
} class represents the application itself. It is used
6 \begin{itemize
}\itemsep=
0pt
7 \item set and get application-wide properties;
8 \item implement the windowing system message or event loop;
9 \item initiate application processing via
\helpref{wxApp::OnInit
}{wxapponinit
};
10 \item allow default processing of events not handled by other
11 objects in the application.
14 You should use the macro IMPLEMENT
\_APP(appClass) in your application implementation
15 file to tell wxWidgets how to create an instance of your application class.
17 Use DECLARE
\_APP(appClass) in a header file if you want the wxGetApp function (which returns
18 a reference to your application object) to be visible to other files.
20 \wxheading{Derived from
}
22 \helpref{wxEvtHandler
}{wxevthandler
}\\
23 \helpref{wxObject
}{wxobject
}
25 \wxheading{Include files
}
31 \helpref{wxBase
}{librarieslist
}
35 \helpref{wxApp overview
}{wxappoverview
}
37 \latexignore{\rtfignore{\wxheading{Members
}}}
40 \membersection{wxApp::wxApp
}\label{wxappctor
}
44 Constructor. Called implicitly with a definition of a wxApp object.
47 \membersection{wxApp::
\destruct{wxApp
}}\label{wxappdtor
}
49 \func{virtual
}{\destruct{wxApp
}}{\void}
51 Destructor. Will be called implicitly on program exit if the wxApp
52 object is created on the stack.
55 \membersection{wxApp::argc
}\label{wxappargc
}
59 Number of command line arguments (after environment-specific processing).
62 \membersection{wxApp::argv
}\label{wxappargv
}
64 \member{wxChar **
}{argv
}
66 Command line arguments (after environment-specific processing).
67 Under Windows and Linux/Unix, you should parse the command line
68 arguments and check for files to be opened when starting your
69 application. Under OS X, you need to override
\helpref{MacOpenFile
}{wxappmacopenfile
}
70 since command line arguments are used differently there.
72 You may use the
\helpref{wxCmdLineParser
}{wxcmdlineparser
} to
73 parse command line arguments.
75 \membersection{wxApp::CreateLogTarget
}\label{wxappcreatelogtarget
}
77 \func{virtual wxLog*
}{CreateLogTarget
}{\void}
79 Creates a wxLog class for the application to use for logging errors. The default
80 implementation returns a new wxLogGui class.
84 \helpref{wxLog
}{wxlog
}
87 \membersection{wxApp::CreateTraits
}\label{wxappcreatetraits
}
89 \func{virtual wxAppTraits *
}{CreateTraits
}{\void}
91 Creates the
\helpref{wxAppTraits
}{wxapptraits
} object when
\helpref{GetTraits
}{wxappgettraits
}
92 needs it for the first time.
96 \helpref{wxAppTraits
}{wxapptraits
}
99 \membersection{wxApp::Dispatch
}\label{wxappdispatch
}
101 \func{virtual void
}{Dispatch
}{\void}
103 Dispatches the next event in the windowing system event queue.
105 This can be used for programming event loops, e.g.
108 while (app.Pending())
114 \helpref{wxApp::Pending
}{wxapppending
}
117 \membersection{wxApp::ExitMainLoop
}\label{wxappexitmainloop
}
119 \func{virtual void
}{ExitMainLoop
}{\void}
121 Call this to explicitly exit the main message (event) loop.
122 You should normally exit the main loop (and the application) by deleting
126 \membersection{wxApp::FilterEvent
}\label{wxappfilterevent
}
128 \func{int
}{FilterEvent
}{\param{wxEvent\&
}{event
}}
130 This function is called before processing any event and allows the application
131 to preempt the processing of some events. If this method returns $-
1$ the event
132 is processed normally, otherwise either
{\tt true
} or
{\tt false
} should be
133 returned and the event processing stops immediately considering that the event
134 had been already processed (for the former return value) or that it is not
135 going to be processed at all (for the latter one).
138 \membersection{wxApp::GetAppDisplayName
}\label{wxappgetappdisplayname
}
140 \constfunc{wxString
}{GetAppDisplayName
}{\void}
142 Returns the user-readable application name. The difference between this string
143 and the one returned by
\helpref{GetAppName
}{wxappgetappname
} is that this one
144 is meant to be shown to the user and so should be used for the window titles,
145 page headers and so on while the other one should be only used internally, e.g.
146 for the file names or configuration file keys.
148 By default, returns the same string as
\helpref{GetAppName
}{wxappgetappname
}.
153 \membersection{wxApp::GetAppName
}\label{wxappgetappname
}
155 \constfunc{wxString
}{GetAppName
}{\void}
157 Returns the application name.
161 wxWidgets sets this to a reasonable default before
162 calling
\helpref{wxApp::OnInit
}{wxapponinit
}, but the application can reset it at will.
166 \helpref{GetAppDisplayName
}{wxappgetappdisplayname
}
169 \membersection{wxApp::GetClassName
}\label{wxappgetclassname
}
171 \constfunc{wxString
}{GetClassName
}{\void}
173 Gets the class name of the application. The class name may be used in a platform specific
174 manner to refer to the application.
178 \helpref{wxApp::SetClassName
}{wxappsetclassname
}
181 \membersection{wxApp::GetExitOnFrameDelete
}\label{wxappgetexitonframedelete
}
183 \constfunc{bool
}{GetExitOnFrameDelete
}{\void}
185 Returns true if the application will exit when the top-level window is deleted, false
190 \helpref{wxApp::SetExitOnFrameDelete
}{wxappsetexitonframedelete
},\\
191 \helpref{wxApp shutdown overview
}{wxappshutdownoverview
}
194 \membersection{wxApp::GetInstance
}\label{wxappgetinstance
}
196 \func{static wxAppConsole *
}{GetInstance
}{\void}
198 Returns the one and only global application object.
199 Usually
\texttt{wxTheApp
} is usead instead.
203 \helpref{wxApp::SetInstance
}{wxappsetinstance
}
206 \membersection{wxApp::GetTopWindow
}\label{wxappgettopwindow
}
208 \constfunc{virtual wxWindow *
}{GetTopWindow
}{\void}
210 Returns a pointer to the top window.
214 If the top window hasn't been set using
\helpref{wxApp::SetTopWindow
}{wxappsettopwindow
}, this
215 function will find the first top-level window (frame or dialog) and return that.
219 \helpref{SetTopWindow
}{wxappsettopwindow
}
223 \membersection{wxApp::GetTraits
}\label{wxappgettraits
}
225 \func{wxAppTraits *
}{GetTraits
}{\void}
227 Returns a pointer to the
\helpref{wxAppTraits
}{wxapptraits
} object for the application.
228 If you want to customize the
\helpref{wxAppTraits
}{wxapptraits
} object, you must override the
229 \helpref{CreateTraits
}{wxappcreatetraits
} function.
233 \membersection{wxApp::GetUseBestVisual
}\label{wxappgetusebestvisual
}
235 \constfunc{bool
}{GetUseBestVisual
}{\void}
237 Returns true if the application will use the best visual on systems that support
238 different visuals, false otherwise.
242 \helpref{SetUseBestVisual
}{wxappsetusebestvisual
}
245 \membersection{wxApp::GetVendorDisplayName
}\label{wxappgetvendordisplayname
}
247 \constfunc{wxString
}{GetVendorDisplayName
}{\void}
249 Returns the user-readable vendor name. The difference between this string
250 and the one returned by
\helpref{GetVendorName
}{wxappgetvendorname
} is that this one
251 is meant to be shown to the user and so should be used for the window titles,
252 page headers and so on while the other one should be only used internally, e.g.
253 for the file names or configuration file keys.
255 By default, returns the same string as
\helpref{GetVendorName
}{wxappgetvendorname
}.
260 \membersection{wxApp::GetVendorName
}\label{wxappgetvendorname
}
262 \constfunc{wxString
}{GetVendorName
}{\void}
264 Returns the application's vendor name.
267 \membersection{wxApp::IsActive
}\label{wxappisactive
}
269 \constfunc{bool
}{IsActive
}{\void}
271 Returns
\true if the application is active, i.e. if one of its windows is
272 currently in the foreground. If this function returns
\false and you need to
273 attract users attention to the application, you may use
274 \helpref{wxTopLevelWindow::RequestUserAttention
}{wxtoplevelwindowrequestuserattention
}
278 \membersection{wxApp::IsMainLoopRunning
}\label{wxappismainlooprunning
}
280 \func{static bool
}{IsMainLoopRunning
}{\void}
282 Returns
\true if the main event loop is currently running, i.e. if the
283 application is inside
\helpref{OnRun
}{wxapponrun
}.
285 This can be useful to test whether events can be dispatched. For example,
286 if this function returns
\false, non-blocking sockets cannot be used because
287 the events from them would never be processed.
290 \membersection{wxApp::MacNewFile
}\label{wxappmacnewfile
}
292 \func{void
}{MacNewFile
}{\void}
294 Mac specific. Called in response of an "open-application" Apple event.
295 Override this to create a new
document in your app.
297 \membersection{wxApp::MacOpenFile
}\label{wxappmacopenfile
}
299 \func{void
}{MacOpenFile
}{\param{const wxString\&
}{fileName
}}
301 Mac specific. Called in response of an "open-
document" Apple event. You need to
302 override this method in order to open a
document file after the
303 user double clicked on it or if the
document file was dropped
304 on either the running application or the application icon in
307 \membersection{wxApp::MacOpenURL
}\label{wxappmacopenurl
}
309 \func{void
}{MacOpenURL
}{\param{const wxString\&
}{url
}}
311 Mac specific. Called in response of a "get-url" Apple event.
313 \membersection{wxApp::MacPrintFile
}\label{wxappmacprintfile
}
315 \func{void
}{MacPrintFile
}{\param{const wxString\&
}{fileName
}}
317 Mac specific. Called in response of a "print-
document" Apple event.
320 \membersection{wxApp::MacReopenApp
}\label{wxappmacreopenapp
}
322 \func{void
}{MacReopenApp
}{\void}
324 Mac specific. Called in response of a "reopen-application" Apple event.
326 \membersection{wxApp::MainLoop
}\label{wxappmainloop
}
328 \func{virtual int
}{MainLoop
}{\void}
330 Called by wxWidgets on creation of the application. Override this if you wish
331 to provide your own (environment-dependent) main loop.
333 \wxheading{Return value
}
335 Returns
0 under X, and the wParam of the WM
\_QUIT message under Windows.
337 %% VZ: OnXXX() functions should *not* be documented
339 %%\membersection{wxApp::OnActivate}\label{wxapponactivate}
341 %%\func{void}{OnActivate}{\param{wxActivateEvent\& }{event}}
343 %%Provide this member function to know whether the application is being
344 %%activated or deactivated (Windows only).
346 %%\wxheading{See also}
348 %%\helpref{wxWindow::OnActivate}{wxwindowonactivate}, \helpref{wxActivateEvent}{wxactivateevent}
350 %%\membersection{wxApp::OnCharHook}\label{wxapponcharhook}
352 %%\func{void}{OnCharHook}{\param{wxKeyEvent\&}{ event}}
354 %%This event handler function is called (under Windows only) to allow the window to intercept keyboard events
355 %%before they are processed by child windows.
357 %%\wxheading{Parameters}
359 %%\docparam{event}{The keypress event.}
361 %%\wxheading{Remarks}
363 %%Use the wxEVT\_CHAR\_HOOK macro in your event table.
365 %%If you use this member, you can selectively consume keypress events by calling\rtfsp
366 %%\helpref{wxEvent::Skip}{wxeventskip} for characters the application is not interested in.
368 %%\wxheading{See also}
370 %%\helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnChar}{wxwindowonchar},\rtfsp
371 %%\helpref{wxWindow::OnCharHook}{wxwindowoncharhook}, \helpref{wxDialog::OnCharHook}{wxdialogoncharhook}
374 \membersection{wxApp::OnAssertFailure
}\label{wxapponassertfailure
}
376 \func{void
}{OnAssertFailure
}{\param{const wxChar
}{*file
},
\param{int
}{line
},
\param{const wxChar
}{*func
},
\param{const wxChar
}{*cond
},
\param{const wxChar
}{*msg
}}
378 This function is called when an assert failure occurs, i.e. the condition
379 specified in
\helpref{wxASSERT
}{wxassert
} macro evaluated to
{\tt false
}.
380 It is only called in debug mode (when
{\tt \_\_WXDEBUG\_\_} is defined) as
381 asserts are not left in the release code at all.
383 The base class version shows the default assert failure dialog box proposing to
384 the user to stop the program, continue or ignore all subsequent asserts.
386 \wxheading{Parameters
}
388 \docparam{file
}{the name of the source file where the assert occurred
}
390 \docparam{line
}{the line number in this file where the assert occurred
}
392 \docparam{func
}{the name of the function where the assert occurred, may be
393 empty if the compiler doesn't support C99
\texttt{\_\_FUNCTION\_\_}}
395 \docparam{cond
}{the condition of the failed assert in text form
}
397 \docparam{msg
}{the message specified as argument to
398 \helpref{wxASSERT
\_MSG}{wxassertmsg
} or
\helpref{wxFAIL
\_MSG}{wxfailmsg
}, will
399 be
{\tt NULL
} if just
\helpref{wxASSERT
}{wxassert
} or
\helpref{wxFAIL
}{wxfail
}
403 \membersection{wxApp::OnCmdLineError
}\label{wxapponcmdlineerror
}
405 \func{bool
}{OnCmdLineError
}{\param{wxCmdLineParser\&
}{parser
}}
407 Called when command line parsing fails (i.e. an incorrect command line option
408 was specified by the user). The default behaviour is to show the program usage
409 text and abort the program.
411 Return
{\tt true
} to continue normal execution or
{\tt false
} to return
412 {\tt false
} from
\helpref{OnInit
}{wxapponinit
} thus terminating the program.
416 \helpref{OnInitCmdLine
}{wxapponinitcmdline
}
419 \membersection{wxApp::OnCmdLineHelp
}\label{wxapponcmdlinehelp
}
421 \func{bool
}{OnCmdLineHelp
}{\param{wxCmdLineParser\&
}{parser
}}
423 Called when the help option (
{\tt --help
}) was specified on the command line.
424 The default behaviour is to show the program usage text and abort the program.
426 Return
{\tt true
} to continue normal execution or
{\tt false
} to return
427 {\tt false
} from
\helpref{OnInit
}{wxapponinit
} thus terminating the program.
431 \helpref{OnInitCmdLine
}{wxapponinitcmdline
}
434 \membersection{wxApp::OnCmdLineParsed
}\label{wxapponcmdlineparsed
}
436 \func{bool
}{OnCmdLineParsed
}{\param{wxCmdLineParser\&
}{parser
}}
438 Called after the command line had been successfully parsed. You may override
439 this method to test for the values of the various parameters which could be
440 set from the command line.
442 Don't forget to call the base class version unless you want to suppress
443 processing of the standard command line options.
445 Return
{\tt true
} to continue normal execution or
{\tt false
} to return
446 {\tt false
} from
\helpref{OnInit
}{wxapponinit
} thus terminating the program.
450 \helpref{OnInitCmdLine
}{wxapponinitcmdline
}
453 \membersection{wxApp::OnExceptionInMainLoop
}\label{wxapponexceptioninmainloop
}
455 \func{virtual bool
}{OnExceptionInMainLoop
}{\void}
457 This function is called if an unhandled exception occurs inside the main
458 application event loop. It can return
\true to ignore the exception and to
459 continue running the loop or
\false to exit the loop and terminate the
460 program. In the latter case it can also use C++
\texttt{throw
} keyword to
461 rethrow the current exception.
463 The default behaviour of this function is the latter in all ports except under
464 Windows where a dialog is shown to the user which allows him to choose between
465 the different options. You may override this function in your class to do
466 something more appropriate.
468 Finally note that if the exception is rethrown from here, it can be caught in
469 \helpref{OnUnhandledException
}{wxapponunhandledexception
}.
472 \membersection{wxApp::OnExit
}\label{wxapponexit
}
474 \func{virtual int
}{OnExit
}{\void}
476 Override this member function for any processing which needs to be
477 done as the application is about to exit. OnExit is called after
478 destroying all application windows and controls, but before
479 wxWidgets cleanup. Note that it is not called at all if
480 \helpref{OnInit
}{wxapponinit
} failed.
482 The return value of this function is currently ignored, return the same value
483 as returned by the base class method if you override it.
486 \membersection{wxApp::OnFatalException
}\label{wxapponfatalexception
}
488 \func{void
}{OnFatalException
}{\void}
490 This function may be called if something fatal happens: an unhandled
491 exception under Win32 or a a fatal signal under Unix, for example. However,
492 this will not happen by default: you have to explicitly call
493 \helpref{wxHandleFatalExceptions
}{wxhandlefatalexceptions
} to enable this.
495 Generally speaking, this function should only show a message to the user and
496 return. You may attempt to save unsaved data but this is not guaranteed to
497 work and, in fact, probably won't.
501 \helpref{wxHandleFatalExceptions
}{wxhandlefatalexceptions
}
503 %% VZ: the wxApp event handler are private and should not be documented here!
505 %%\membersection{wxApp::OnIdle}\label{wxapponidle}
507 %%\func{void}{OnIdle}{\param{wxIdleEvent\& }{event}}
509 %%Override this member function for any processing which needs to be done
510 %%when the application is idle. You should call wxApp::OnIdle from your own function,
511 %%since this forwards OnIdle events to windows and also performs garbage collection for
512 %%windows whose destruction has been delayed.
514 %%wxWidgets' strategy for OnIdle processing is as follows. After pending user interface events for an
515 %%application have all been processed, wxWidgets sends an OnIdle event to the application object. wxApp::OnIdle itself
516 %%sends an OnIdle event to each application window, allowing windows to do idle processing such as updating
517 %%their appearance. If either wxApp::OnIdle or a window OnIdle function requested more time, by
518 %%calling \helpref{wxIdleEvent::RequestMore}{wxidleeventrequestmore}, wxWidgets will send another OnIdle
519 %%event to the application object. This will occur in a loop until either a user event is found to be
520 %%pending, or OnIdle requests no more time. Then all pending user events are processed until the system
521 %%goes idle again, when OnIdle is called, and so on.
523 %%\wxheading{See also}
525 %%\helpref{wxWindow::OnIdle}{wxwindowonidle}, \helpref{wxIdleEvent}{wxidleevent},\rtfsp
526 %%\helpref{wxWindow::SendIdleEvents}{wxappsendidleevents}
528 %%\membersection{wxApp::OnEndSession}\label{wxapponendsession}
530 %%\func{void}{OnEndSession}{\param{wxCloseEvent\& }{event}}
532 %%This is an event handler function called when the operating system or GUI session is
533 %%about to close down. The application has a chance to silently save information,
534 %%and can optionally close itself.
536 %%Use the EVT\_END\_SESSION event table macro to handle query end session events.
538 %%The default handler calls \helpref{wxWindow::Close}{wxwindowclose} with a true argument
539 %%(forcing the application to close itself silently).
541 %%\wxheading{Remarks}
543 %%Under X, OnEndSession is called in response to the `die' event.
545 %%Under Windows, OnEndSession is called in response to the WM\_ENDSESSION message.
547 %%\wxheading{See also}
549 %%\helpref{wxWindow::Close}{wxwindowclose},\rtfsp
550 %%\helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp
551 %%\helpref{wxCloseEvent}{wxcloseevent},\rtfsp
554 \membersection{wxApp::OnInit
}\label{wxapponinit
}
556 \func{bool
}{OnInit
}{\void}
558 This must be provided by the application, and will usually create the
559 application's main window, optionally calling
560 \helpref{wxApp::SetTopWindow
}{wxappsettopwindow
}. You may use
561 \helpref{OnExit
}{wxapponexit
} to clean up anything initialized here, provided
562 that the function returns
\true.
564 Notice that if you want to to use the command line processing provided by
565 wxWidgets you have to call the base class version in the derived class
568 Return
\true to continue processing,
\false to exit the application
572 \membersection{wxApp::OnInitCmdLine
}\label{wxapponinitcmdline
}
574 \func{void
}{OnInitCmdLine
}{\param{wxCmdLineParser\&
}{parser
}}
576 Called from
\helpref{OnInit
}{wxapponinit
} and may be used to initialize the
577 parser with the command line options for this application. The base class
578 versions adds support for a few standard options only.
580 \membersection{wxApp::OnRun
}\label{wxapponrun
}
582 \func{virtual int
}{OnRun
}{\void}
584 This virtual function is where the execution of a program written in wxWidgets
585 starts. The default implementation just enters the main loop and starts
586 handling the events until it terminates, either because
587 \helpref{ExitMainLoop
}{wxappexitmainloop
} has been explicitly called or because
588 the last frame has been deleted and
589 \helpref{GetExitOnFrameDelete
}{wxappgetexitonframedelete
} flag is
\true (this
592 The return value of this function becomes the exit code of the program, so it
593 should return $
0$ in case of successful termination.
596 \membersection{wxApp::OnUnhandledException
}\label{wxapponunhandledexception
}
598 \func{virtual void
}{OnUnhandledException
}{\void}
600 This function is called when an unhandled C++ exception occurs inside
601 \helpref{OnRun()
}{wxapponrun
} (the exceptions which occur during the program
602 startup and shutdown might not be caught at all). Notice that by now the main
603 event loop has been terminated and the program will exit, if you want to
604 prevent this from happening (i.e. continue running after catching an exception)
605 you need to override
\helpref{OnExceptionInMainLoop
}{wxapponexceptioninmainloop
}.
607 The default implementation shows information about the exception in debug build
608 but does nothing in the release build.
611 \membersection{wxApp::ProcessMessage
}\label{wxappprocessmessage
}
613 \func{bool
}{ProcessMessage
}{\param{WXMSG *
}{msg
}}
615 Windows-only function for processing a message. This function
616 is called from the main message loop, checking for windows that
617 may wish to process it. The function returns true if the message
618 was processed, false otherwise. If you use wxWidgets with another class
619 library with its own message loop, you should make sure that this
620 function is called to allow wxWidgets to receive messages. For example,
621 to allow co-existence with the Microsoft Foundation Classes, override
622 the PreTranslateMessage function:
625 // Provide wxWidgets message loop compatibility
626 BOOL CTheApp::PreTranslateMessage(MSG *msg)
628 if (wxTheApp && wxTheApp->ProcessMessage((WXMSW *)msg))
631 return CWinApp::PreTranslateMessage(msg);
636 \membersection{wxApp::Pending
}\label{wxapppending
}
638 \func{virtual bool
}{Pending
}{\void}
640 Returns true if unprocessed events are in the window system event queue.
644 \helpref{wxApp::Dispatch
}{wxappdispatch
}
647 \membersection{wxApp::SendIdleEvents
}\label{wxappsendidleevents
}
649 \func{bool
}{SendIdleEvents
}{\param{wxWindow*
}{ win
},
\param{wxIdleEvent\&
}{event
}}
651 Sends idle events to a window and its children.
653 Please note that this function is internal to wxWidgets and shouldn't be used
658 These functions poll the top-level windows, and their children, for idle event processing.
659 If true is returned, more OnIdle processing is requested by one or more window.
663 \helpref{wxIdleEvent
}{wxidleevent
}
666 \membersection{wxApp::SetAppDisplayName
}\label{wxappsetappdisplayname
}
668 \func{void
}{SetAppDisplayName
}{\param{const wxString\&
}{name
}}
670 Set the application name to be used in the user-visible places such as window
671 titles. See
\helpref{GetAppDisplayName
}{wxappgetappdisplayname
} for more about
672 the differences between the display name and name.
675 \membersection{wxApp::SetAppName
}\label{wxappsetappname
}
677 \func{void
}{SetAppName
}{\param{const wxString\&
}{name
}}
679 Sets the name of the application. This name should be used for file names,
680 configuration file entries and other internal strings. For the user-visible
681 strings, such as the window titles, the application display name set by
682 \helpref{SetAppDisplayName
}{wxappsetappdisplayname
} is used instead.
684 By default the application name is set to the name of its executable file.
688 \helpref{wxApp::GetAppName
}{wxappgetappname
}
691 \membersection{wxApp::SetClassName
}\label{wxappsetclassname
}
693 \func{void
}{SetClassName
}{\param{const wxString\&
}{name
}}
695 Sets the class name of the application. This may be used in a platform specific
696 manner to refer to the application.
700 \helpref{wxApp::GetClassName
}{wxappgetclassname
}
703 \membersection{wxApp::SetExitOnFrameDelete
}\label{wxappsetexitonframedelete
}
705 \func{void
}{SetExitOnFrameDelete
}{\param{bool
}{ flag
}}
707 Allows the programmer to specify whether the application will exit when the
708 top-level frame is deleted.
710 \wxheading{Parameters
}
712 \docparam{flag
}{If true (the default), the application will exit when the top-level frame is
713 deleted. If false, the application will continue to run.
}
717 \helpref{wxApp::GetExitOnFrameDelete
}{wxappgetexitonframedelete
},\\
718 \helpref{wxApp shutdown overview
}{wxappshutdownoverview
}
721 \membersection{wxApp::SetInstance
}\label{wxappsetinstance
}
723 \func{static void
}{SetInstance
}{\param{wxAppConsole*
}{app
}}
725 Allows external code to modify global
\texttt{wxTheApp
}, but you should really
726 know what you're doing if you call it.
728 \wxheading{Parameters
}
730 \docparam{app
}{Replacement for the global application object.
}
734 \helpref{wxApp::GetInstance
}{wxappgetinstance
}
737 \membersection{wxApp::SetTopWindow
}\label{wxappsettopwindow
}
739 \func{void
}{SetTopWindow
}{\param{wxWindow*
}{window
}}
741 Sets the `top' window. You can call this from within
\helpref{wxApp::OnInit
}{wxapponinit
} to
742 let wxWidgets know which is the main window. You don't have to set the top window;
743 it is only a convenience so that (for example) certain dialogs without parents can use a
744 specific window as the top window. If no top window is specified by the application,
745 wxWidgets just uses the first frame or dialog in its top-level window list, when it
746 needs to use the top window.
748 \wxheading{Parameters
}
750 \docparam{window
}{The new top window.
}
754 \helpref{wxApp::GetTopWindow
}{wxappgettopwindow
},
\helpref{wxApp::OnInit
}{wxapponinit
}
757 \membersection{wxApp::SetVendorDisplayName
}\label{wxappsetvendordisplayname
}
759 \func{void
}{SetVendorDisplayName
}{\param{const wxString\&
}{name
}}
761 Set the vendor name to be used in the user-visible places. See
762 \helpref{GetVendorDisplayName
}{wxappgetvendordisplayname
} for more about
763 the differences between the display name and name.
766 \membersection{wxApp::SetVendorName
}\label{wxappsetvendorname
}
768 \func{void
}{SetVendorName
}{\param{const wxString\&
}{name
}}
770 Sets the name of application's vendor. The name will be used
771 in registry access. A default name is set by
776 \helpref{wxApp::GetVendorName
}{wxappgetvendorname
}
779 \membersection{wxApp::SetUseBestVisual
}\label{wxappsetusebestvisual
}
781 \func{void
}{SetUseBestVisual
}{\param{bool
}{ flag
},
\param{bool
}{ forceTrueColour = false
}}
783 Allows the programmer to specify whether the application will use the best visual
784 on systems that support several visual on the same display. This is typically the
785 case under Solaris and IRIX, where the default visual is only
8-bit whereas certain
786 applications are supposed to run in TrueColour mode.
788 If
\arg{forceTrueColour
} is true then the application will try to force
789 using a TrueColour visual and abort the app if none is found.
791 Note that this function has to be called in the constructor of the
{\tt wxApp
}
792 instance and won't have any effect when called later on.
794 This function currently only has effect under GTK.
796 \wxheading{Parameters
}
798 \docparam{flag
}{If true, the app will use the best visual.
}
801 \membersection{wxApp::HandleEvent
}\label{wxapphandleevent
}
803 \constfunc{virtual void
}{HandleEvent
}{\param{wxEvtHandler
}{ *handler
},
\param{wxEventFunction
}{ func
},
\param{wxEvent\&
}{event
}}
805 This function simply invokes the given method
\arg{func
} of the specified
806 event handler
\arg{handler
} with the
\arg{event
} as parameter. It exists solely
807 to allow to catch the C++ exceptions which could be thrown by all event
808 handlers in the application in one place: if you want to do this, override this
809 function in your wxApp-derived class and add try/catch clause(s) to it.
812 \membersection{wxApp::Yield
}\label{wxappyield
}
814 \func{bool
}{Yield
}{\param{bool
}{ onlyIfNeeded = false
}}
816 Yields control to pending messages in the windowing system. This can be useful, for example, when a
817 time-consuming process writes to a text window. Without an occasional
818 yield, the text window will not be updated properly, and on systems with
819 cooperative multitasking, such as Windows
3.1 other processes will not respond.
821 Caution should be exercised, however, since yielding may allow the
822 user to perform actions which are not compatible with the current task.
823 Disabling menu items or whole menus during processing can avoid unwanted
824 reentrance of code: see
\helpref{::wxSafeYield
}{wxsafeyield
} for a better
827 Note that Yield() will not flush the message logs. This is intentional as
828 calling Yield() is usually done to quickly update the screen and popping up a
829 message box dialog may be undesirable. If you do wish to flush the log
830 messages immediately (otherwise it will be done during the next idle loop
831 iteration), call
\helpref{wxLog::FlushActive
}{wxlogflushactive
}.
833 Calling Yield() recursively is normally an error and an assert failure is
834 raised in debug build if such situation is detected. However if the
835 {\it onlyIfNeeded
} parameter is
{\tt true
}, the method will just silently
836 return
{\tt false
} instead.