]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/app.tex
syntax correction
[wxWidgets.git] / docs / latex / wx / app.tex
1 \section{\class{wxApp}}\label{wxapp}
2
3 The {\bf wxApp} class represents the application itself. It is used
4 to:
5
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.
12 \end{itemize}
13
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.
16
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.
19
20 \wxheading{Derived from}
21
22 \helpref{wxEvtHandler}{wxevthandler}\\
23 \helpref{wxObject}{wxobject}
24
25 \wxheading{Include files}
26
27 <wx/app.h>
28
29 \wxheading{Library}
30
31 \helpref{wxBase}{librarieslist}
32
33 \wxheading{See also}
34
35 \helpref{wxApp overview}{wxappoverview}
36
37 \latexignore{\rtfignore{\wxheading{Members}}}
38
39
40 \membersection{wxApp::wxApp}\label{wxappctor}
41
42 \func{}{wxApp}{\void}
43
44 Constructor. Called implicitly with a definition of a wxApp object.
45
46
47 \membersection{wxApp::\destruct{wxApp}}\label{wxappdtor}
48
49 \func{virtual}{\destruct{wxApp}}{\void}
50
51 Destructor. Will be called implicitly on program exit if the wxApp
52 object is created on the stack.
53
54
55 \membersection{wxApp::argc}\label{wxappargc}
56
57 \member{int}{argc}
58
59 Number of command line arguments (after environment-specific processing).
60
61
62 \membersection{wxApp::argv}\label{wxappargv}
63
64 \member{wxChar **}{argv}
65
66 Command line arguments (after environment-specific processing).
67
68
69 \membersection{wxApp::CreateLogTarget}\label{wxappcreatelogtarget}
70
71 \func{virtual wxLog*}{CreateLogTarget}{\void}
72
73 Creates a wxLog class for the application to use for logging errors. The default
74 implementation returns a new wxLogGui class.
75
76 \wxheading{See also}
77
78 \helpref{wxLog}{wxlog}
79
80
81 \membersection{wxApp::CreateTraits}\label{wxappcreatetraits}
82
83 \func{virtual wxAppTraits *}{CreateTraits}{\void}
84
85 Creates the \helpref{wxAppTraits}{wxapptraits} object when \helpref{GetTraits}{wxappgettraits}
86 needs it for the first time.
87
88 \wxheading{See also}
89
90 \helpref{wxAppTraits}{wxapptraits}
91
92
93 \membersection{wxApp::Dispatch}\label{wxappdispatch}
94
95 \func{virtual void}{Dispatch}{\void}
96
97 Dispatches the next event in the windowing system event queue.
98
99 This can be used for programming event loops, e.g.
100
101 \begin{verbatim}
102 while (app.Pending())
103 Dispatch();
104 \end{verbatim}
105
106 \wxheading{See also}
107
108 \helpref{wxApp::Pending}{wxapppending}
109
110
111 \membersection{wxApp::ExitMainLoop}\label{wxappexitmainloop}
112
113 \func{virtual void}{ExitMainLoop}{\void}
114
115 Call this to explicitly exit the main message (event) loop.
116 You should normally exit the main loop (and the application) by deleting
117 the top window.
118
119
120 \membersection{wxApp::FilterEvent}\label{wxappfilterevent}
121
122 \func{int}{FilterEvent}{\param{wxEvent\& }{event}}
123
124 This function is called before processing any event and allows the application
125 to preempt the processing of some events. If this method returns $-1$ the event
126 is processed normally, otherwise either {\tt true} or {\tt false} should be
127 returned and the event processing stops immediately considering that the event
128 had been already processed (for the former return value) or that it is not
129 going to be processed at all (for the latter one).
130
131
132 \membersection{wxApp::GetAppName}\label{wxappgetappname}
133
134 \constfunc{wxString}{GetAppName}{\void}
135
136 Returns the application name.
137
138 \wxheading{Remarks}
139
140 wxWidgets sets this to a reasonable default before
141 calling \helpref{wxApp::OnInit}{wxapponinit}, but the application can reset it at will.
142
143
144 \membersection{wxApp::GetClassName}\label{wxappgetclassname}
145
146 \constfunc{wxString}{GetClassName}{\void}
147
148 Gets the class name of the application. The class name may be used in a platform specific
149 manner to refer to the application.
150
151 \wxheading{See also}
152
153 \helpref{wxApp::SetClassName}{wxappsetclassname}
154
155
156 \membersection{wxApp::GetExitOnFrameDelete}\label{wxappgetexitonframedelete}
157
158 \constfunc{bool}{GetExitOnFrameDelete}{\void}
159
160 Returns true if the application will exit when the top-level window is deleted, false
161 otherwise.
162
163 \wxheading{See also}
164
165 \helpref{wxApp::SetExitOnFrameDelete}{wxappsetexitonframedelete},\\
166 \helpref{wxApp shutdown overview}{wxappshutdownoverview}
167
168
169 \membersection{wxApp::GetInstance}\label{wxappgetinstance}
170
171 \func{static wxAppConsole *}{GetInstance}{\void}
172
173 Returns the one and only global application object.
174 Usually \texttt{wxTheApp} is usead instead.
175
176 \wxheading{See also}
177
178 \helpref{wxApp::SetInstance}{wxappsetinstance}
179
180
181 \membersection{wxApp::GetTopWindow}\label{wxappgettopwindow}
182
183 \constfunc{virtual wxWindow *}{GetTopWindow}{\void}
184
185 Returns a pointer to the top window.
186
187 \wxheading{Remarks}
188
189 If the top window hasn't been set using \helpref{wxApp::SetTopWindow}{wxappsettopwindow}, this
190 function will find the first top-level window (frame or dialog) and return that.
191
192 \wxheading{See also}
193
194 \helpref{SetTopWindow}{wxappsettopwindow}
195
196
197
198 \membersection{wxApp::GetTraits}\label{wxappgettraits}
199
200 \func{wxAppTraits *}{GetTraits}{\void}
201
202 Returns a pointer to the \helpref{wxAppTraits}{wxapptraits} object for the application.
203 If you want to customize the \helpref{wxAppTraits}{wxapptraits} object, you must override the
204 \helpref{CreateTraits}{wxappcreatetraits} function.
205
206
207
208 \membersection{wxApp::GetUseBestVisual}\label{wxappgetusebestvisual}
209
210 \constfunc{bool}{GetUseBestVisual}{\void}
211
212 Returns true if the application will use the best visual on systems that support
213 different visuals, false otherwise.
214
215 \wxheading{See also}
216
217 \helpref{SetUseBestVisual}{wxappsetusebestvisual}
218
219
220 \membersection{wxApp::GetVendorName}\label{wxappgetvendorname}
221
222 \constfunc{wxString}{GetVendorName}{\void}
223
224 Returns the application's vendor name.
225
226
227 \membersection{wxApp::IsActive}\label{wxappisactive}
228
229 \constfunc{bool}{IsActive}{\void}
230
231 Returns \true if the application is active, i.e. if one of its windows is
232 currently in the foreground. If this function returns \false and you need to
233 attract users attention to the application, you may use
234 \helpref{wxTopLevelWindow::RequestUserAttention}{wxtoplevelwindowrequestuserattention}
235 to do it.
236
237
238 \membersection{wxApp::IsMainLoopRunning}\label{wxappismainlooprunning}
239
240 \func{static bool}{IsMainLoopRunning}{\void}
241
242 Returns \true if the main event loop is currently running, i.e. if the
243 application is inside \helpref{OnRun}{wxapponrun}.
244
245 This can be useful to test whether events can be dispatched. For example,
246 if this function returns \false, non-blocking sockets cannot be used because
247 the events from them would never be processed.
248
249
250 \membersection{wxApp::MainLoop}\label{wxappmainloop}
251
252 \func{virtual int}{MainLoop}{\void}
253
254 Called by wxWidgets on creation of the application. Override this if you wish
255 to provide your own (environment-dependent) main loop.
256
257 \wxheading{Return value}
258
259 Returns 0 under X, and the wParam of the WM\_QUIT message under Windows.
260
261 %% VZ: OnXXX() functions should *not* be documented
262 %%
263 %%\membersection{wxApp::OnActivate}\label{wxapponactivate}
264 %%
265 %%\func{void}{OnActivate}{\param{wxActivateEvent\& }{event}}
266 %%
267 %%Provide this member function to know whether the application is being
268 %%activated or deactivated (Windows only).
269 %%
270 %%\wxheading{See also}
271 %%
272 %%\helpref{wxWindow::OnActivate}{wxwindowonactivate}, \helpref{wxActivateEvent}{wxactivateevent}
273 %%
274 %%\membersection{wxApp::OnCharHook}\label{wxapponcharhook}
275 %%
276 %%\func{void}{OnCharHook}{\param{wxKeyEvent\&}{ event}}
277 %%
278 %%This event handler function is called (under Windows only) to allow the window to intercept keyboard events
279 %%before they are processed by child windows.
280 %%
281 %%\wxheading{Parameters}
282 %%
283 %%\docparam{event}{The keypress event.}
284 %%
285 %%\wxheading{Remarks}
286 %%
287 %%Use the wxEVT\_CHAR\_HOOK macro in your event table.
288 %%
289 %%If you use this member, you can selectively consume keypress events by calling\rtfsp
290 %%\helpref{wxEvent::Skip}{wxeventskip} for characters the application is not interested in.
291 %%
292 %%\wxheading{See also}
293 %%
294 %%\helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnChar}{wxwindowonchar},\rtfsp
295 %%\helpref{wxWindow::OnCharHook}{wxwindowoncharhook}, \helpref{wxDialog::OnCharHook}{wxdialogoncharhook}
296
297
298 \membersection{wxApp::OnAssertFailure}\label{wxapponassertfailure}
299
300 \func{void}{OnAssertFailure}{\param{const wxChar }{*file}, \param{int }{line}, \param{const wxChar }{*func}, \param{const wxChar }{*cond}, \param{const wxChar }{*msg}}
301
302 This function is called when an assert failure occurs, i.e. the condition
303 specified in \helpref{wxASSERT}{wxassert} macro evaluated to {\tt false}.
304 It is only called in debug mode (when {\tt \_\_WXDEBUG\_\_} is defined) as
305 asserts are not left in the release code at all.
306
307 The base class version shows the default assert failure dialog box proposing to
308 the user to stop the program, continue or ignore all subsequent asserts.
309
310 \wxheading{Parameters}
311
312 \docparam{file}{the name of the source file where the assert occurred}
313
314 \docparam{line}{the line number in this file where the assert occurred}
315
316 \docparam{func}{the name of the function where the assert occurred, may be
317 empty if the compiler doesn't support C99 \texttt{\_\_FUNCTION\_\_}}
318
319 \docparam{cond}{the condition of the failed assert in text form}
320
321 \docparam{msg}{the message specified as argument to
322 \helpref{wxASSERT\_MSG}{wxassertmsg} or \helpref{wxFAIL\_MSG}{wxfailmsg}, will
323 be {\tt NULL} if just \helpref{wxASSERT}{wxassert} or \helpref{wxFAIL}{wxfail}
324 was used}
325
326
327 \membersection{wxApp::OnCmdLineError}\label{wxapponcmdlineerror}
328
329 \func{bool}{OnCmdLineError}{\param{wxCmdLineParser\& }{parser}}
330
331 Called when command line parsing fails (i.e. an incorrect command line option
332 was specified by the user). The default behaviour is to show the program usage
333 text and abort the program.
334
335 Return {\tt true} to continue normal execution or {\tt false} to return
336 {\tt false} from \helpref{OnInit}{wxapponinit} thus terminating the program.
337
338 \wxheading{See also}
339
340 \helpref{OnInitCmdLine}{wxapponinitcmdline}
341
342
343 \membersection{wxApp::OnCmdLineHelp}\label{wxapponcmdlinehelp}
344
345 \func{bool}{OnCmdLineHelp}{\param{wxCmdLineParser\& }{parser}}
346
347 Called when the help option ({\tt --help}) was specified on the command line.
348 The default behaviour is to show the program usage text and abort the program.
349
350 Return {\tt true} to continue normal execution or {\tt false} to return
351 {\tt false} from \helpref{OnInit}{wxapponinit} thus terminating the program.
352
353 \wxheading{See also}
354
355 \helpref{OnInitCmdLine}{wxapponinitcmdline}
356
357
358 \membersection{wxApp::OnCmdLineParsed}\label{wxapponcmdlineparsed}
359
360 \func{bool}{OnCmdLineParsed}{\param{wxCmdLineParser\& }{parser}}
361
362 Called after the command line had been successfully parsed. You may override
363 this method to test for the values of the various parameters which could be
364 set from the command line.
365
366 Don't forget to call the base class version unless you want to suppress
367 processing of the standard command line options.
368
369 Return {\tt true} to continue normal execution or {\tt false} to return
370 {\tt false} from \helpref{OnInit}{wxapponinit} thus terminating the program.
371
372 \wxheading{See also}
373
374 \helpref{OnInitCmdLine}{wxapponinitcmdline}
375
376
377 \membersection{wxApp::OnExceptionInMainLoop}\label{wxapponexceptioninmainloop}
378
379 \func{virtual bool}{OnExceptionInMainLoop}{\void}
380
381 This function is called if an unhandled exception occurs inside the main
382 application event loop. It can return \true to ignore the exception and to
383 continue running the loop or \false to exit the loop and terminate the
384 program. In the latter case it can also use C++ \texttt{throw} keyword to
385 rethrow the current exception.
386
387 The default behaviour of this function is the latter in all ports except under
388 Windows where a dialog is shown to the user which allows him to choose between
389 the different options. You may override this function in your class to do
390 something more appropriate.
391
392 Finally note that if the exception is rethrown from here, it can be caught in
393 \helpref{OnUnhandledException}{wxapponunhandledexception}.
394
395
396 \membersection{wxApp::OnExit}\label{wxapponexit}
397
398 \func{virtual int}{OnExit}{\void}
399
400 Override this member function for any processing which needs to be
401 done as the application is about to exit. OnExit is called after
402 destroying all application windows and controls, but before
403 wxWidgets cleanup. Note that it is not called at all if
404 \helpref{OnInit}{wxapponinit} failed.
405
406 The return value of this function is currently ignored, return the same value
407 as returned by the base class method if you override it.
408
409
410 \membersection{wxApp::OnFatalException}\label{wxapponfatalexception}
411
412 \func{void}{OnFatalException}{\void}
413
414 This function may be called if something fatal happens: an unhandled
415 exception under Win32 or a a fatal signal under Unix, for example. However,
416 this will not happen by default: you have to explicitly call
417 \helpref{wxHandleFatalExceptions}{wxhandlefatalexceptions} to enable this.
418
419 Generally speaking, this function should only show a message to the user and
420 return. You may attempt to save unsaved data but this is not guaranteed to
421 work and, in fact, probably won't.
422
423 \wxheading{See also}
424
425 \helpref{wxHandleFatalExceptions}{wxhandlefatalexceptions}
426
427 %% VZ: the wxApp event handler are private and should not be documented here!
428 %%
429 %%\membersection{wxApp::OnIdle}\label{wxapponidle}
430 %%
431 %%\func{void}{OnIdle}{\param{wxIdleEvent\& }{event}}
432 %%
433 %%Override this member function for any processing which needs to be done
434 %%when the application is idle. You should call wxApp::OnIdle from your own function,
435 %%since this forwards OnIdle events to windows and also performs garbage collection for
436 %%windows whose destruction has been delayed.
437 %%
438 %%wxWidgets' strategy for OnIdle processing is as follows. After pending user interface events for an
439 %%application have all been processed, wxWidgets sends an OnIdle event to the application object. wxApp::OnIdle itself
440 %%sends an OnIdle event to each application window, allowing windows to do idle processing such as updating
441 %%their appearance. If either wxApp::OnIdle or a window OnIdle function requested more time, by
442 %%calling \helpref{wxIdleEvent::RequestMore}{wxidleeventrequestmore}, wxWidgets will send another OnIdle
443 %%event to the application object. This will occur in a loop until either a user event is found to be
444 %%pending, or OnIdle requests no more time. Then all pending user events are processed until the system
445 %%goes idle again, when OnIdle is called, and so on.
446 %%
447 %%\wxheading{See also}
448 %%
449 %%\helpref{wxWindow::OnIdle}{wxwindowonidle}, \helpref{wxIdleEvent}{wxidleevent},\rtfsp
450 %%\helpref{wxWindow::SendIdleEvents}{wxappsendidleevents}
451 %%
452 %%\membersection{wxApp::OnEndSession}\label{wxapponendsession}
453 %%
454 %%\func{void}{OnEndSession}{\param{wxCloseEvent\& }{event}}
455 %%
456 %%This is an event handler function called when the operating system or GUI session is
457 %%about to close down. The application has a chance to silently save information,
458 %%and can optionally close itself.
459 %%
460 %%Use the EVT\_END\_SESSION event table macro to handle query end session events.
461 %%
462 %%The default handler calls \helpref{wxWindow::Close}{wxwindowclose} with a true argument
463 %%(forcing the application to close itself silently).
464 %%
465 %%\wxheading{Remarks}
466 %%
467 %%Under X, OnEndSession is called in response to the `die' event.
468 %%
469 %%Under Windows, OnEndSession is called in response to the WM\_ENDSESSION message.
470 %%
471 %%\wxheading{See also}
472 %%
473 %%\helpref{wxWindow::Close}{wxwindowclose},\rtfsp
474 %%\helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp
475 %%\helpref{wxCloseEvent}{wxcloseevent},\rtfsp
476
477
478 \membersection{wxApp::OnInit}\label{wxapponinit}
479
480 \func{bool}{OnInit}{\void}
481
482 This must be provided by the application, and will usually create the
483 application's main window, optionally calling
484 \helpref{wxApp::SetTopWindow}{wxappsettopwindow}. You may use
485 \helpref{OnExit}{wxapponexit} to clean up anything initialized here, provided
486 that the function returns \true.
487
488 Notice that if you want to to use the command line processing provided by
489 wxWidgets you have to call the base class version in the derived class
490 OnInit().
491
492 Return \true to continue processing, \false to exit the application
493 immediately.
494
495
496 \membersection{wxApp::OnInitCmdLine}\label{wxapponinitcmdline}
497
498 \func{void}{OnInitCmdLine}{\param{wxCmdLineParser\& }{parser}}
499
500 Called from \helpref{OnInit}{wxapponinit} and may be used to initialize the
501 parser with the command line options for this application. The base class
502 versions adds support for a few standard options only.
503
504 \membersection{wxApp::OnRun}\label{wxapponrun}
505
506 \func{virtual int}{OnRun}{\void}
507
508 This virtual function is where the execution of a program written in wxWidgets
509 starts. The default implementation just enters the main loop and starts
510 handling the events until it terminates, either because
511 \helpref{ExitMainLoop}{wxappexitmainloop} has been explicitly called or because
512 the last frame has been deleted and
513 \helpref{GetExitOnFrameDelete}{wxappgetexitonframedelete} flag is \true (this
514 is the default).
515
516 The return value of this function becomes the exit code of the program, so it
517 should return $0$ in case of successful termination.
518
519
520 \membersection{wxApp::OnUnhandledException}\label{wxapponunhandledexception}
521
522 \func{virtual void}{OnUnhandledException}{\void}
523
524 This function is called when an unhandled C++ exception occurs inside
525 \helpref{OnRun()}{wxapponrun} (the exceptions which occur during the program
526 startup and shutdown might not be caught at all). Notice that by now the main
527 event loop has been terminated and the program will exit, if you want to
528 prevent this from happening (i.e. continue running after catching an exception)
529 you need to override \helpref{OnExceptionInMainLoop}{wxapponexceptioninmainloop}.
530
531 The default implementation shows information about the exception in debug build
532 but does nothing in the release build.
533
534
535 \membersection{wxApp::ProcessMessage}\label{wxappprocessmessage}
536
537 \func{bool}{ProcessMessage}{\param{WXMSG *}{msg}}
538
539 Windows-only function for processing a message. This function
540 is called from the main message loop, checking for windows that
541 may wish to process it. The function returns true if the message
542 was processed, false otherwise. If you use wxWidgets with another class
543 library with its own message loop, you should make sure that this
544 function is called to allow wxWidgets to receive messages. For example,
545 to allow co-existence with the Microsoft Foundation Classes, override
546 the PreTranslateMessage function:
547
548 \begin{verbatim}
549 // Provide wxWidgets message loop compatibility
550 BOOL CTheApp::PreTranslateMessage(MSG *msg)
551 {
552 if (wxTheApp && wxTheApp->ProcessMessage((WXMSW *)msg))
553 return true;
554 else
555 return CWinApp::PreTranslateMessage(msg);
556 }
557 \end{verbatim}
558
559
560 \membersection{wxApp::Pending}\label{wxapppending}
561
562 \func{virtual bool}{Pending}{\void}
563
564 Returns true if unprocessed events are in the window system event queue.
565
566 \wxheading{See also}
567
568 \helpref{wxApp::Dispatch}{wxappdispatch}
569
570
571 \membersection{wxApp::SendIdleEvents}\label{wxappsendidleevents}
572
573 \func{bool}{SendIdleEvents}{\param{wxWindow*}{ win}, \param{wxIdleEvent\& }{event}}
574
575 Sends idle events to a window and its children.
576
577 Please note that this function is internal to wxWidgets and shouldn't be used
578 by user code.
579
580 \wxheading{Remarks}
581
582 These functions poll the top-level windows, and their children, for idle event processing.
583 If true is returned, more OnIdle processing is requested by one or more window.
584
585 \wxheading{See also}
586
587 \helpref{wxIdleEvent}{wxidleevent}
588
589
590 \membersection{wxApp::SetAppName}\label{wxappsetappname}
591
592 \func{void}{SetAppName}{\param{const wxString\& }{name}}
593
594 Sets the name of the application. The name may be used in dialogs
595 (for example by the document/view framework). A default name is set by
596 wxWidgets.
597
598 \wxheading{See also}
599
600 \helpref{wxApp::GetAppName}{wxappgetappname}
601
602
603 \membersection{wxApp::SetClassName}\label{wxappsetclassname}
604
605 \func{void}{SetClassName}{\param{const wxString\& }{name}}
606
607 Sets the class name of the application. This may be used in a platform specific
608 manner to refer to the application.
609
610 \wxheading{See also}
611
612 \helpref{wxApp::GetClassName}{wxappgetclassname}
613
614
615 \membersection{wxApp::SetExitOnFrameDelete}\label{wxappsetexitonframedelete}
616
617 \func{void}{SetExitOnFrameDelete}{\param{bool}{ flag}}
618
619 Allows the programmer to specify whether the application will exit when the
620 top-level frame is deleted.
621
622 \wxheading{Parameters}
623
624 \docparam{flag}{If true (the default), the application will exit when the top-level frame is
625 deleted. If false, the application will continue to run.}
626
627 \wxheading{See also}
628
629 \helpref{wxApp::GetExitOnFrameDelete}{wxappgetexitonframedelete},\\
630 \helpref{wxApp shutdown overview}{wxappshutdownoverview}
631
632
633 \membersection{wxApp::SetInstance}\label{wxappsetinstance}
634
635 \func{static void}{SetInstance}{\param{wxAppConsole* }{app}}
636
637 Allows external code to modify global \texttt{wxTheApp}, but you should really
638 know what you're doing if you call it.
639
640 \wxheading{Parameters}
641
642 \docparam{app}{Replacement for the global application object.}
643
644 \wxheading{See also}
645
646 \helpref{wxApp::GetInstance}{wxappgetinstance}
647
648
649 \membersection{wxApp::SetTopWindow}\label{wxappsettopwindow}
650
651 \func{void}{SetTopWindow}{\param{wxWindow* }{window}}
652
653 Sets the `top' window. You can call this from within \helpref{wxApp::OnInit}{wxapponinit} to
654 let wxWidgets know which is the main window. You don't have to set the top window;
655 it is only a convenience so that (for example) certain dialogs without parents can use a
656 specific window as the top window. If no top window is specified by the application,
657 wxWidgets just uses the first frame or dialog in its top-level window list, when it
658 needs to use the top window.
659
660 \wxheading{Parameters}
661
662 \docparam{window}{The new top window.}
663
664 \wxheading{See also}
665
666 \helpref{wxApp::GetTopWindow}{wxappgettopwindow}, \helpref{wxApp::OnInit}{wxapponinit}
667
668
669
670 \membersection{wxApp::SetVendorName}\label{wxappsetvendorname}
671
672 \func{void}{SetVendorName}{\param{const wxString\& }{name}}
673
674 Sets the name of application's vendor. The name will be used
675 in registry access. A default name is set by
676 wxWidgets.
677
678 \wxheading{See also}
679
680 \helpref{wxApp::GetVendorName}{wxappgetvendorname}
681
682
683 \membersection{wxApp::SetUseBestVisual}\label{wxappsetusebestvisual}
684
685 \func{void}{SetUseBestVisual}{\param{bool}{ flag}, \param{bool}{ forceTrueColour = false}}
686
687 Allows the programmer to specify whether the application will use the best visual
688 on systems that support several visual on the same display. This is typically the
689 case under Solaris and IRIX, where the default visual is only 8-bit whereas certain
690 applications are supposed to run in TrueColour mode.
691
692 If \arg{forceTrueColour} is true then the application will try to force
693 using a TrueColour visual and abort the app if none is found.
694
695 Note that this function has to be called in the constructor of the {\tt wxApp}
696 instance and won't have any effect when called later on.
697
698 This function currently only has effect under GTK.
699
700 \wxheading{Parameters}
701
702 \docparam{flag}{If true, the app will use the best visual.}
703
704
705 \membersection{wxApp::HandleEvent}\label{wxapphandleevent}
706
707 \constfunc{virtual void}{HandleEvent}{\param{wxEvtHandler}{ *handler}, \param{wxEventFunction}{ func}, \param{wxEvent\& }{event}}
708
709 This function simply invokes the given method \arg{func} of the specified
710 event handler \arg{handler} with the \arg{event} as parameter. It exists solely
711 to allow to catch the C++ exceptions which could be thrown by all event
712 handlers in the application in one place: if you want to do this, override this
713 function in your wxApp-derived class and add try/catch clause(s) to it.
714
715
716 \membersection{wxApp::Yield}\label{wxappyield}
717
718 \func{bool}{Yield}{\param{bool}{ onlyIfNeeded = false}}
719
720 Yields control to pending messages in the windowing system. This can be useful, for example, when a
721 time-consuming process writes to a text window. Without an occasional
722 yield, the text window will not be updated properly, and on systems with
723 cooperative multitasking, such as Windows 3.1 other processes will not respond.
724
725 Caution should be exercised, however, since yielding may allow the
726 user to perform actions which are not compatible with the current task.
727 Disabling menu items or whole menus during processing can avoid unwanted
728 reentrance of code: see \helpref{::wxSafeYield}{wxsafeyield} for a better
729 function.
730
731 Note that Yield() will not flush the message logs. This is intentional as
732 calling Yield() is usually done to quickly update the screen and popping up a
733 message box dialog may be undesirable. If you do wish to flush the log
734 messages immediately (otherwise it will be done during the next idle loop
735 iteration), call \helpref{wxLog::FlushActive}{wxlogflushactive}.
736
737 Calling Yield() recursively is normally an error and an assert failure is
738 raised in debug build if such situation is detected. However if the
739 {\it onlyIfNeeded} parameter is {\tt true}, the method will just silently
740 return {\tt false} instead.
741