]> git.saurik.com Git - wxWidgets.git/blame - interface/app.h
latex include not properly working for links and titlepage
[wxWidgets.git] / interface / app.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: app.h
3// Purpose: documentation for wxApp class
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxApp
11 @wxheader{app.h}
7c913512 12
23324ae1
FM
13 The @b wxApp class represents the application itself. It is used
14 to:
7c913512 15
23324ae1
FM
16 set and get application-wide properties;
17 implement the windowing system message or event loop;
18 initiate application processing via wxApp::OnInit;
19 allow default processing of events not handled by other
20 objects in the application.
7c913512 21
23324ae1
FM
22 You should use the macro IMPLEMENT_APP(appClass) in your application
23 implementation
24 file to tell wxWidgets how to create an instance of your application class.
7c913512 25
23324ae1
FM
26 Use DECLARE_APP(appClass) in a header file if you want the wxGetApp function
27 (which returns
28 a reference to your application object) to be visible to other files.
7c913512 29
23324ae1
FM
30 @library{wxbase}
31 @category{appmanagement}
7c913512 32
23324ae1
FM
33 @seealso
34 @ref overview_wxappoverview "wxApp overview"
35*/
36class wxApp : public wxEvtHandler
37{
38public:
39 /**
40 Constructor. Called implicitly with a definition of a wxApp object.
41 */
42 wxApp();
43
44 /**
45 Destructor. Will be called implicitly on program exit if the wxApp
46 object is created on the stack.
47 */
48 ~wxApp();
49
50 /**
51 Creates a wxLog class for the application to use for logging errors. The default
52 implementation returns a new wxLogGui class.
53
54 @sa wxLog
55 */
56 virtual wxLog* CreateLogTarget();
57
58 /**
59 Creates the wxAppTraits object when GetTraits()
60 needs it for the first time.
61
62 @sa wxAppTraits
63 */
64 virtual wxAppTraits * CreateTraits();
65
66 /**
67 Dispatches the next event in the windowing system event queue.
68
69 This can be used for programming event loops, e.g.
70
71 @sa Pending()
72 */
73 virtual void Dispatch();
74
75 /**
76 Call this to explicitly exit the main message (event) loop.
77 You should normally exit the main loop (and the application) by deleting
78 the top window.
79 */
80 virtual void ExitMainLoop();
81
82 /**
83 This function is called before processing any event and allows the application
84 to preempt the processing of some events. If this method returns -1 the event
85 is processed normally, otherwise either @true or @false should be
86 returned and the event processing stops immediately considering that the event
87 had been already processed (for the former return value) or that it is not
88 going to be processed at all (for the latter one).
89 */
90 int FilterEvent(wxEvent& event);
91
92 /**
93 Returns the user-readable application name. The difference between this string
94 and the one returned by GetAppName() is that this one
95 is meant to be shown to the user and so should be used for the window titles,
96 page headers and so on while the other one should be only used internally, e.g.
97 for the file names or configuration file keys.
98
99 By default, returns the same string as GetAppName().
100
101 This function is new since wxWidgets version 2.9.0
102 */
103 wxString GetAppDisplayName();
104
105 /**
106 Returns the application name.
107
108 @remarks wxWidgets sets this to a reasonable default before calling
109 OnInit(), but the application can reset it at
110 will.
111
112 @sa GetAppDisplayName()
113 */
114 wxString GetAppName();
115
116 /**
117 Gets the class name of the application. The class name may be used in a
118 platform specific
119 manner to refer to the application.
120
121 @sa SetClassName()
122 */
123 wxString GetClassName();
124
125 /**
126 Returns @true if the application will exit when the top-level window is deleted,
127 @false
128 otherwise.
129
130 @sa SetExitOnFrameDelete(), @ref overview_wxappshutdownoverview "wxApp
131 shutdown overview"
132 */
133 bool GetExitOnFrameDelete();
134
135 /**
136 Returns the one and only global application object.
137 Usually @c wxTheApp is usead instead.
138
139 @sa SetInstance()
140 */
141 static wxAppConsole * GetInstance();
142
143 /**
144 Returns a pointer to the top window.
145
146 @remarks If the top window hasn't been set using SetTopWindow(),
147 this function will find the first top-level window
148 (frame or dialog) and return that.
149
150 @sa SetTopWindow()
151 */
152 virtual wxWindow * GetTopWindow();
153
154 /**
155 Returns a pointer to the wxAppTraits object for the application.
156 If you want to customize the wxAppTraits object, you must override the
157 CreateTraits() function.
158 */
159 wxAppTraits * GetTraits();
160
161 /**
162 Returns @true if the application will use the best visual on systems that support
163 different visuals, @false otherwise.
164
165 @sa SetUseBestVisual()
166 */
167 bool GetUseBestVisual();
168
169 /**
170 Returns the user-readable vendor name. The difference between this string
171 and the one returned by GetVendorName() is that this one
172 is meant to be shown to the user and so should be used for the window titles,
173 page headers and so on while the other one should be only used internally, e.g.
174 for the file names or configuration file keys.
175
176 By default, returns the same string as GetVendorName().
177
178 This function is new since wxWidgets version 2.9.0
179 */
180 wxString GetVendorDisplayName();
181
182 /**
183 Returns the application's vendor name.
184 */
185 wxString GetVendorName();
186
187 /**
188 This function simply invokes the given method @e func of the specified
189 event handler @e handler with the @e event as parameter. It exists solely
190 to allow to catch the C++ exceptions which could be thrown by all event
191 handlers in the application in one place: if you want to do this, override this
192 function in your wxApp-derived class and add try/catch clause(s) to it.
193 */
194 virtual void HandleEvent(wxEvtHandler handler,
195 wxEventFunction func,
196 wxEvent& event);
197
198 /**
199 Returns @true if the application is active, i.e. if one of its windows is
200 currently in the foreground. If this function returns @false and you need to
7c913512
FM
201 attract users attention to the application, you may use
202 wxTopLevelWindow::RequestUserAttention
23324ae1
FM
203 to do it.
204 */
205 bool IsActive();
206
207 /**
208 Returns @true if the main event loop is currently running, i.e. if the
209 application is inside OnRun().
210
211 This can be useful to test whether events can be dispatched. For example,
212 if this function returns @false, non-blocking sockets cannot be used because
213 the events from them would never be processed.
214 */
215 static bool IsMainLoopRunning();
216
217 /**
218 Mac specific. Called in response of an "open-application" Apple event.
219 Override this to create a new document in your app.
220 */
221 void MacNewFile();
222
223 /**
7c913512 224 Mac specific. Called in response of an "open-document" Apple event. You need to
23324ae1
FM
225 override this method in order to open a document file after the
226 user double clicked on it or if the document file was dropped
227 on either the running application or the application icon in
228 Finder.
229 */
230 void MacOpenFile(const wxString& fileName);
231
232 /**
233 Mac specific. Called in response of a "get-url" Apple event.
234 */
235 void MacOpenURL(const wxString& url);
236
237 /**
238 Mac specific. Called in response of a "print-document" Apple event.
239 */
240 void MacPrintFile(const wxString& fileName);
241
242 /**
243 Mac specific. Called in response of a "reopen-application" Apple event.
244 */
245 void MacReopenApp();
246
247 /**
248 Called by wxWidgets on creation of the application. Override this if you wish
249 to provide your own (environment-dependent) main loop.
250
251 @returns Returns 0 under X, and the wParam of the WM_QUIT message under
252 Windows.
253 */
254 virtual int MainLoop();
255
256 /**
257 This function is called when an assert failure occurs, i.e. the condition
258 specified in wxASSERT macro evaluated to @false.
259 It is only called in debug mode (when @c __WXDEBUG__ is defined) as
260 asserts are not left in the release code at all.
261
262 The base class version shows the default assert failure dialog box proposing to
263 the user to stop the program, continue or ignore all subsequent asserts.
264
7c913512 265 @param file
23324ae1
FM
266 the name of the source file where the assert occurred
267
7c913512 268 @param line
23324ae1
FM
269 the line number in this file where the assert occurred
270
7c913512 271 @param func
23324ae1
FM
272 the name of the function where the assert occurred, may be
273 empty if the compiler doesn't support C99 __FUNCTION__
274
7c913512 275 @param cond
23324ae1
FM
276 the condition of the failed assert in text form
277
7c913512
FM
278 @param msg
279 the message specified as argument to
23324ae1 280 wxASSERT_MSG or wxFAIL_MSG, will
7c913512 281 be @NULL if just wxASSERT or wxFAIL
23324ae1
FM
282 was used
283 */
284 void OnAssertFailure(const wxChar file, int line,
285 const wxChar func,
286 const wxChar cond,
287 const wxChar msg);
288
289 /**
290 Called when command line parsing fails (i.e. an incorrect command line option
291 was specified by the user). The default behaviour is to show the program usage
292 text and abort the program.
293
7c913512 294 Return @true to continue normal execution or @false to return
23324ae1
FM
295 @false from OnInit() thus terminating the program.
296
297 @sa OnInitCmdLine()
298 */
299 bool OnCmdLineError(wxCmdLineParser& parser);
300
301 /**
302 Called when the help option (@c --help) was specified on the command line.
303 The default behaviour is to show the program usage text and abort the program.
304
7c913512 305 Return @true to continue normal execution or @false to return
23324ae1
FM
306 @false from OnInit() thus terminating the program.
307
308 @sa OnInitCmdLine()
309 */
310 bool OnCmdLineHelp(wxCmdLineParser& parser);
311
312 /**
313 Called after the command line had been successfully parsed. You may override
314 this method to test for the values of the various parameters which could be
315 set from the command line.
316
317 Don't forget to call the base class version unless you want to suppress
318 processing of the standard command line options.
319
7c913512 320 Return @true to continue normal execution or @false to return
23324ae1
FM
321 @false from OnInit() thus terminating the program.
322
323 @sa OnInitCmdLine()
324 */
325 bool OnCmdLineParsed(wxCmdLineParser& parser);
326
327 /**
328 This function is called if an unhandled exception occurs inside the main
329 application event loop. It can return @true to ignore the exception and to
330 continue running the loop or @false to exit the loop and terminate the
331 program. In the latter case it can also use C++ @c throw keyword to
332 rethrow the current exception.
333
334 The default behaviour of this function is the latter in all ports except under
335 Windows where a dialog is shown to the user which allows him to choose between
336 the different options. You may override this function in your class to do
337 something more appropriate.
338
7c913512 339 Finally note that if the exception is rethrown from here, it can be caught in
23324ae1
FM
340 OnUnhandledException().
341 */
342 virtual bool OnExceptionInMainLoop();
343
344 /**
345 Override this member function for any processing which needs to be
346 done as the application is about to exit. OnExit is called after
347 destroying all application windows and controls, but before
7c913512 348 wxWidgets cleanup. Note that it is not called at all if
23324ae1
FM
349 OnInit() failed.
350
351 The return value of this function is currently ignored, return the same value
352 as returned by the base class method if you override it.
353 */
354 virtual int OnExit();
355
356 /**
357 This function may be called if something fatal happens: an unhandled
358 exception under Win32 or a a fatal signal under Unix, for example. However,
7c913512 359 this will not happen by default: you have to explicitly call
23324ae1
FM
360 wxHandleFatalExceptions to enable this.
361
362 Generally speaking, this function should only show a message to the user and
363 return. You may attempt to save unsaved data but this is not guaranteed to
364 work and, in fact, probably won't.
365
366 @sa wxHandleFatalExceptions
367 */
368 void OnFatalException();
369
370 /**
371 This must be provided by the application, and will usually create the
7c913512
FM
372 application's main window, optionally calling
373 SetTopWindow(). You may use
23324ae1
FM
374 OnExit() to clean up anything initialized here, provided
375 that the function returns @true.
376
377 Notice that if you want to to use the command line processing provided by
378 wxWidgets you have to call the base class version in the derived class
379 OnInit().
380
381 Return @true to continue processing, @false to exit the application
382 immediately.
383 */
384 bool OnInit();
385
386 /**
387 Called from OnInit() and may be used to initialize the
388 parser with the command line options for this application. The base class
389 versions adds support for a few standard options only.
390 */
391 void OnInitCmdLine(wxCmdLineParser& parser);
392
393 /**
394 This virtual function is where the execution of a program written in wxWidgets
395 starts. The default implementation just enters the main loop and starts
7c913512 396 handling the events until it terminates, either because
23324ae1 397 ExitMainLoop() has been explicitly called or because
7c913512 398 the last frame has been deleted and
23324ae1
FM
399 GetExitOnFrameDelete() flag is @true (this
400 is the default).
401
402 The return value of this function becomes the exit code of the program, so it
403 should return 0 in case of successful termination.
404 */
405 virtual int OnRun();
406
407 /**
7c913512 408 This function is called when an unhandled C++ exception occurs inside
23324ae1
FM
409 OnRun() (the exceptions which occur during the program
410 startup and shutdown might not be caught at all). Notice that by now the main
411 event loop has been terminated and the program will exit, if you want to
412 prevent this from happening (i.e. continue running after catching an exception)
413 you need to override OnExceptionInMainLoop().
414
415 The default implementation shows information about the exception in debug build
416 but does nothing in the release build.
417 */
418 virtual void OnUnhandledException();
419
420 /**
421 Returns @true if unprocessed events are in the window system event queue.
422
423 @sa Dispatch()
424 */
425 virtual bool Pending();
426
427 /**
428 Windows-only function for processing a message. This function
429 is called from the main message loop, checking for windows that
430 may wish to process it. The function returns @true if the message
431 was processed, @false otherwise. If you use wxWidgets with another class
432 library with its own message loop, you should make sure that this
433 function is called to allow wxWidgets to receive messages. For example,
434 to allow co-existence with the Microsoft Foundation Classes, override
435 the PreTranslateMessage function:
436 */
437 bool ProcessMessage(WXMSG * msg);
438
439 /**
440 Sends idle events to a window and its children.
441
442 Please note that this function is internal to wxWidgets and shouldn't be used
443 by user code.
444
445 @remarks These functions poll the top-level windows, and their children,
446 for idle event processing. If @true is returned, more
447 OnIdle processing is requested by one or more window.
448
449 @sa wxIdleEvent
450 */
451 bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
452
453 /**
454 Set the application name to be used in the user-visible places such as window
455 titles. See GetAppDisplayName() for more about
456 the differences between the display name and name.
457 */
458 void SetAppDisplayName(const wxString& name);
459
460 /**
461 Sets the name of the application. This name should be used for file names,
462 configuration file entries and other internal strings. For the user-visible
7c913512 463 strings, such as the window titles, the application display name set by
23324ae1
FM
464 SetAppDisplayName() is used instead.
465
466 By default the application name is set to the name of its executable file.
467
468 @sa GetAppName()
469 */
470 void SetAppName(const wxString& name);
471
472 /**
473 Sets the class name of the application. This may be used in a platform specific
474 manner to refer to the application.
475
476 @sa GetClassName()
477 */
478 void SetClassName(const wxString& name);
479
480 /**
481 Allows the programmer to specify whether the application will exit when the
482 top-level frame is deleted.
483
7c913512 484 @param flag
23324ae1
FM
485 If @true (the default), the application will exit when the top-level frame is
486 deleted. If @false, the application will continue to run.
487
488 @sa GetExitOnFrameDelete(), @ref overview_wxappshutdownoverview "wxApp
489 shutdown overview"
490 */
491 void SetExitOnFrameDelete(bool flag);
492
493 /**
494 Allows external code to modify global @c wxTheApp, but you should really
495 know what you're doing if you call it.
496
7c913512 497 @param app
23324ae1
FM
498 Replacement for the global application object.
499
500 @sa GetInstance()
501 */
502 static void SetInstance(wxAppConsole* app);
503
504 /**
505 Allows runtime switching of the UI environment theme. Currently implemented for
506 wxGTK2-only.
507
508 Return @true if theme was successfully changed.
509
7c913512 510 @param theme
23324ae1
FM
511 The name of the new theme or an absolute path to a gtkrc-theme-file
512 */
513 bool SetNativeTheme();
514
515 /**
516 Sets the 'top' window. You can call this from within OnInit() to
517 let wxWidgets know which is the main window. You don't have to set the top
518 window;
519 it is only a convenience so that (for example) certain dialogs without parents
520 can use a
521 specific window as the top window. If no top window is specified by the
522 application,
523 wxWidgets just uses the first frame or dialog in its top-level window list,
524 when it
525 needs to use the top window.
526
7c913512 527 @param window
23324ae1
FM
528 The new top window.
529
530 @sa GetTopWindow(), OnInit()
531 */
532 void SetTopWindow(wxWindow* window);
533
534 /**
535 Allows the programmer to specify whether the application will use the best
536 visual
537 on systems that support several visual on the same display. This is typically
538 the
539 case under Solaris and IRIX, where the default visual is only 8-bit whereas
540 certain
541 applications are supposed to run in TrueColour mode.
542
543 If @e forceTrueColour is @true then the application will try to force
544 using a TrueColour visual and abort the app if none is found.
545
7c913512 546 Note that this function has to be called in the constructor of the @c wxApp
23324ae1
FM
547 instance and won't have any effect when called later on.
548
549 This function currently only has effect under GTK.
550
7c913512 551 @param flag
23324ae1
FM
552 If @true, the app will use the best visual.
553 */
554 void SetUseBestVisual(bool flag, bool forceTrueColour = @false);
555
556 /**
557 Set the vendor name to be used in the user-visible places. See
558 GetVendorDisplayName() for more about
559 the differences between the display name and name.
560 */
561 void SetVendorDisplayName(const wxString& name);
562
563 /**
564 Sets the name of application's vendor. The name will be used
565 in registry access. A default name is set by
566 wxWidgets.
567
568 @sa GetVendorName()
569 */
570 void SetVendorName(const wxString& name);
571
572 /**
573 Yields control to pending messages in the windowing system. This can be useful,
574 for example, when a
575 time-consuming process writes to a text window. Without an occasional
576 yield, the text window will not be updated properly, and on systems with
577 cooperative multitasking, such as Windows 3.1 other processes will not respond.
578
579 Caution should be exercised, however, since yielding may allow the
580 user to perform actions which are not compatible with the current task.
581 Disabling menu items or whole menus during processing can avoid unwanted
582 reentrance of code: see ::wxSafeYield for a better
583 function.
584
585 Note that Yield() will not flush the message logs. This is intentional as
586 calling Yield() is usually done to quickly update the screen and popping up a
587 message box dialog may be undesirable. If you do wish to flush the log
588 messages immediately (otherwise it will be done during the next idle loop
589 iteration), call wxLog::FlushActive.
590
591 Calling Yield() recursively is normally an error and an assert failure is
7c913512 592 raised in debug build if such situation is detected. However if the
23324ae1
FM
593 @e onlyIfNeeded parameter is @true, the method will just silently
594 return @false instead.
595 */
596 bool Yield(bool onlyIfNeeded = @false);
597
598 /**
599 int argc
600
601 Number of command line arguments (after environment-specific processing).
602 */
603
604
605 /**
606 wxChar ** argv
607
608 Command line arguments (after environment-specific processing).
609 Under Windows and Linux/Unix, you should parse the command line
610 arguments and check for files to be opened when starting your
611 application. Under OS X, you need to override MacOpenFile()
612 since command line arguments are used differently there.
613
614 You may use the wxCmdLineParser to
615 parse command line arguments.
616 */
617};
618
619
620// ============================================================================
621// Global functions/macros
622// ============================================================================
623
624//@{
625/**
626 For all normal, informational messages. They also appear in a message box by
627 default (but it can be changed).
628*/
629void wxLogMessage(const char * formatString, ... );
7c913512 630void wxVLogMessage(const char * formatString, va_list argPtr);
23324ae1
FM
631//@}
632
633//@{
634/**
635 For verbose output. Normally, it is suppressed, but
636 might be activated if the user wishes to know more details about the program
637 progress (another, but possibly confusing name for the same function is @b
638 wxLogInfo).
639*/
640void wxLogVerbose(const char * formatString, ... );
7c913512 641void wxVLogVerbose(const char * formatString, va_list argPtr);
23324ae1
FM
642//@}
643
644/**
645 This is used in headers to create a forward declaration of the
646 wxGetApp function implemented by
647 wxIMPLEMENT_APP. It creates the declaration
648 @c className wxGetApp(void).
7c913512 649
23324ae1
FM
650 Example:
651 @code
652 wxDECLARE_APP(MyApp)
653 @endcode
654*/
655#define wxDECLARE_APP() /* implementation is private */
656
657/**
658 Exits application after calling wxApp::OnExit.
659 Should only be used in an emergency: normally the top-level frame
660 should be deleted (after deleting all other frames) to terminate the
661 application. See wxCloseEvent and wxApp.
662*/
663void wxExit();
664
665//@{
666/**
667 For warnings - they are also normally shown to the user, but don't interrupt
668 the program work.
669*/
670void wxLogWarning(const char * formatString, ... );
7c913512 671void wxVLogWarning(const char * formatString, va_list argPtr);
23324ae1
FM
672//@}
673
674//@{
675/**
676 Like wxLogError, but also
677 terminates the program with the exit code 3. Using @e abort() standard
678 function also terminates the program with this exit code.
679*/
680void wxLogFatalError(const char * formatString, ... );
7c913512
FM
681void wxVLogFatalError(const char * formatString,
682 va_list argPtr);
23324ae1
FM
683//@}
684
685/**
686 If @e doIt is @true, the fatal exceptions (also known as general protection
687 faults under Windows or segmentation violations in the Unix world) will be
688 caught and passed to wxApp::OnFatalException.
689 By default, i.e. before this function is called, they will be handled in the
690 normal way which usually just means that the application will be terminated.
691 Calling wxHandleFatalExceptions() with @e doIt equal to @false will restore
692 this default behaviour.
7c913512
FM
693
694 Notice that this function is only available if
23324ae1
FM
695 @c wxUSE_ON_FATAL_EXCEPTION is 1 and under Windows platform this
696 requires a compiler with support for SEH (structured exception handling) which
697 currently means only Microsoft Visual C++ or a recent Borland C++ version.
698*/
699bool wxHandleFatalExceptions(bool doIt = @true);
700
701/**
702 This is used in the application class implementation file to make the
703 application class known to
704 wxWidgets for dynamic construction. You use this instead of
7c913512 705
23324ae1
FM
706 Old form:
707 @code
708 MyApp myApp;
709 @endcode
7c913512 710
23324ae1
FM
711 New form:
712 @code
713 IMPLEMENT_APP(MyApp)
714 @endcode
7c913512 715
23324ae1
FM
716 See also DECLARE_APP.
717*/
718#define IMPLEMENT_APP() /* implementation is private */
719
720/**
721 Returns the error code from the last system call. This function uses
722 @c errno on Unix platforms and @c GetLastError under Win32.
7c913512 723
23324ae1
FM
724 @sa wxSysErrorMsg, wxLogSysError
725*/
726unsigned long wxSysErrorCode();
727
728/**
729 In a GUI application, this function posts @e event to the specified @e dest
730 object using wxEvtHandler::AddPendingEvent.
731 Otherwise, it dispatches @e event immediately using
732 wxEvtHandler::ProcessEvent.
733 See the respective documentation for details (and caveats).
734*/
735void wxPostEvent(wxEvtHandler * dest, wxEvent& event);
736
737//@{
738/**
739 The functions to use for error messages, i.e. the messages that must be shown
740 to the user. The default processing is to pop up a message box to inform the
741 user about it.
742*/
743void wxLogError(const char * formatString, ... );
7c913512 744void wxVLogError(const char * formatString, va_list argPtr);
23324ae1
FM
745//@}
746
747//@{
748/**
749 As @b wxLogDebug, trace functions only do something in debug build and
750 expand to nothing in the release one. The reason for making
751 it a separate function from it is that usually there are a lot of trace
752 messages, so it might make sense to separate them from other debug messages.
7c913512 753
23324ae1
FM
754 The trace messages also usually can be separated into different categories and
755 the second and third versions of this function only log the message if the
756 @e mask which it has is currently enabled in wxLog. This
757 allows to selectively trace only some operations and not others by changing
758 the value of the trace mask (possible during the run-time).
7c913512 759
23324ae1
FM
760 For the second function (taking a string mask), the message is logged only if
761 the mask has been previously enabled by the call to
762 wxLog::AddTraceMask or by setting
763 @ref overview_envvars "@c WXTRACE environment variable".
764 The predefined string trace masks
765 used by wxWidgets are:
7c913512 766
23324ae1
FM
767 wxTRACE_MemAlloc: trace memory allocation (new/delete)
768 wxTRACE_Messages: trace window messages/X callbacks
769 wxTRACE_ResAlloc: trace GDI resource allocation
770 wxTRACE_RefCount: trace various ref counting operations
771 wxTRACE_OleCalls: trace OLE method calls (Win32 only)
7c913512 772
23324ae1
FM
773 @b Caveats: since both the mask and the format string are strings,
774 this might lead to function signature confusion in some cases:
775 if you intend to call the format string only version of wxLogTrace,
776 then add a %s format string parameter and then supply a second string parameter
777 for that %s, the string mask version of wxLogTrace will erroneously get called instead, since you are supplying two string parameters to the function.
778 In this case you'll unfortunately have to avoid having two leading
779 string parameters, e.g. by adding a bogus integer (with its %d format string).
7c913512 780
23324ae1
FM
781 The third version of the function only logs the message if all the bits
782 corresponding to the @e mask are set in the wxLog trace mask which can be
783 set by wxLog::SetTraceMask. This version is less
784 flexible than the previous one because it doesn't allow defining the user
785 trace masks easily - this is why it is deprecated in favour of using string
786 trace masks.
7c913512 787
23324ae1
FM
788 wxTraceMemAlloc: trace memory allocation (new/delete)
789 wxTraceMessages: trace window messages/X callbacks
790 wxTraceResAlloc: trace GDI resource allocation
791 wxTraceRefCount: trace various ref counting operations
792 wxTraceOleCalls: trace OLE method calls (Win32 only)
793*/
794void wxLogTrace(const char * formatString, ... );
7c913512
FM
795void wxVLogTrace(const char * formatString, va_list argPtr);
796void wxLogTrace(const char * mask, const char * formatString,
797 ... );
798void wxVLogTrace(const char * mask,
799 const char * formatString,
800 va_list argPtr);
801void wxLogTrace(wxTraceMask mask, const char * formatString,
802 ... );
803void wxVLogTrace(wxTraceMask mask, const char * formatString,
804 va_list argPtr);
23324ae1
FM
805//@}
806
807/**
808 Returns the error message corresponding to the given system error code. If
809 @e errCode is 0 (default), the last error code (as returned by
810 wxSysErrorCode) is used.
7c913512 811
23324ae1
FM
812 @sa wxSysErrorCode, wxLogSysError
813*/
814const wxChar * wxSysErrorMsg(unsigned long errCode = 0);
815
816/**
817 This function is for use in console (wxBase) programs only. It must be called
818 once for each previous successful call to wxInitialize.
819*/
820void wxUninitialize();
821
822//@{
823/**
824 The right functions for debug output. They only do something in debug
825 mode (when the preprocessor symbol __WXDEBUG__ is defined) and expand to
826 nothing in release mode (otherwise).
827*/
828void wxLogDebug(const char * formatString, ... );
7c913512 829void wxVLogDebug(const char * formatString, va_list argPtr);
23324ae1
FM
830//@}
831
832/**
833 This function doesn't exist in wxWidgets but it is created by using
834 the IMPLEMENT_APP macro. Thus, before using it
835 anywhere but in the same module where this macro is used, you must make it
836 available using DECLARE_APP.
7c913512 837
23324ae1
FM
838 The advantage of using this function compared to directly using the global
839 wxTheApp pointer is that the latter is of type @c wxApp * and so wouldn't
840 allow you to access the functions specific to your application class but not
841 present in wxApp while wxGetApp() returns the object of the right type.
842*/
843wxAppDerivedClass wxGetApp();
844
845//@{
846/**
847 Messages logged by these functions will appear in the statusbar of the @e frame
848 or of the top level application window by default (i.e. when using
849 the second version of the functions).
7c913512 850
23324ae1
FM
851 If the target frame doesn't have a statusbar, the message will be lost.
852*/
853void wxLogStatus(wxFrame * frame, const char * formatString,
854 ... );
7c913512
FM
855void wxVLogStatus(wxFrame * frame, const char * formatString,
856 va_list argPtr);
857void wxLogStatus(const char * formatString, ... );
858void wxVLogStatus(const char * formatString, va_list argPtr);
23324ae1
FM
859//@}
860
861/**
862 This function is used in wxBase only and only if you don't create
863 wxApp object at all. In this case you must call it from your
864 @c main() function before calling any other wxWidgets functions.
7c913512 865
23324ae1
FM
866 If the function returns @false the initialization could not be performed,
867 in this case the library cannot be used and
868 wxUninitialize shouldn't be called neither.
7c913512 869
23324ae1
FM
870 This function may be called several times but
871 wxUninitialize must be called for each successful
872 call to this function.
873*/
874bool wxInitialize();
875
876/**
877 This is used in headers to create a forward declaration of the
878 wxGetApp function implemented by
879 IMPLEMENT_APP. It creates the declaration
880 @c className wxGetApp(void).
7c913512 881
23324ae1
FM
882 Example:
883 @code
884 DECLARE_APP(MyApp)
885 @endcode
886*/
887#define DECLARE_APP() /* implementation is private */
888
889/**
890 Calls wxApp::Yield.
7c913512 891
23324ae1
FM
892 This function is kept only for backwards compatibility. Please use
893 the wxApp::Yield method instead in any new code.
894*/
895bool wxYield();
896
897//@{
898/**
899 Mostly used by wxWidgets itself, but might be handy for logging errors after
900 system call (API function) failure. It logs the specified message text as well
901 as the last system error code (@e errno or @e ::GetLastError() depending
902 on the platform) and the corresponding error message. The second form
903 of this function takes the error code explicitly as the first argument.
7c913512 904
23324ae1
FM
905 @sa wxSysErrorCode, wxSysErrorMsg
906*/
907void wxLogSysError(const char * formatString, ... );
7c913512
FM
908void wxVLogSysError(const char * formatString,
909 va_list argPtr);
23324ae1
FM
910//@}
911
912//@{
913/**
914 This initializes wxWidgets in a platform-dependent way. Use this if you are not
915 using the default wxWidgets entry code (e.g. main or WinMain). For example, you
916 can initialize wxWidgets from an Microsoft Foundation Classes application using
917 this function.
7c913512 918
23324ae1 919 The following overload of wxEntry is available under all platforms:
7c913512
FM
920
921 (notice that under Windows CE platform, and only there, the type of
23324ae1
FM
922 @e pCmdLine is @c wchar_t *, otherwise it is @c char *, even in
923 Unicode build).
7c913512 924
23324ae1
FM
925 @remarks To clean up wxWidgets, call wxApp::OnExit followed by the static
926 function wxApp::CleanUp. For example, if exiting from
927 an MFC application that also uses wxWidgets:
7c913512 928
23324ae1
FM
929 @sa wxEntryStart
930*/
931int wxEntry(int& argc, wxChar ** argv);
7c913512
FM
932int wxEntry(HINSTANCE hInstance,
933 HINSTANCE hPrevInstance = @NULL,
934 char * pCmdLine = @NULL,
935 int nCmdShow = SW_SHOWNORMAL);
23324ae1
FM
936//@}
937