Build fix.
[wxWidgets.git] / include / wx / app.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/app.h
3 // Purpose: wxAppBase class and macros used for declaration of wxApp
4 // derived class in the user code
5 // Author: Julian Smart
6 // Modified by:
7 // Created: 01/02/97
8 // RCS-ID: $Id$
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_APP_H_BASE_
14 #define _WX_APP_H_BASE_
15
16 // ----------------------------------------------------------------------------
17 // headers we have to include here
18 // ----------------------------------------------------------------------------
19
20 #include "wx/event.h" // for the base class
21
22 #if wxUSE_GUI
23 #include "wx/window.h" // for wxTopLevelWindows
24
25 #include "wx/vidmode.h"
26 #endif // wxUSE_GUI
27
28 #include "wx/build.h"
29 #include "wx/init.h" // we must declare wxEntry()
30 #include "wx/intl.h"
31
32 class WXDLLIMPEXP_BASE wxAppConsole;
33 class WXDLLIMPEXP_BASE wxAppTraits;
34 class WXDLLIMPEXP_BASE wxCmdLineParser;
35 class WXDLLIMPEXP_BASE wxLog;
36 class WXDLLIMPEXP_BASE wxMessageOutput;
37
38 #if wxUSE_GUI
39 class WXDLLEXPORT wxEventLoop;
40 #endif
41
42 // ----------------------------------------------------------------------------
43 // typedefs
44 // ----------------------------------------------------------------------------
45
46 // the type of the function used to create a wxApp object on program start up
47 typedef wxAppConsole* (*wxAppInitializerFunction)();
48
49 // ----------------------------------------------------------------------------
50 // constants
51 // ----------------------------------------------------------------------------
52
53 enum
54 {
55 wxPRINT_WINDOWS = 1,
56 wxPRINT_POSTSCRIPT = 2
57 };
58
59 // ----------------------------------------------------------------------------
60 // wxAppConsole: wxApp for non-GUI applications
61 // ----------------------------------------------------------------------------
62
63 class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler
64 {
65 public:
66 // ctor and dtor
67 wxAppConsole();
68 virtual ~wxAppConsole();
69
70
71 // the virtual functions which may/must be overridden in the derived class
72 // -----------------------------------------------------------------------
73
74 // This is the very first function called for a newly created wxApp object,
75 // it is used by the library to do the global initialization. If, for some
76 // reason, you must override it (instead of just overriding OnInit(), as
77 // usual, for app-specific initializations), do not forget to call the base
78 // class version!
79 virtual bool Initialize(int& argc, wxChar **argv);
80
81 // This gives wxCocoa a chance to call OnInit() with a memory pool in place
82 virtual bool CallOnInit() { return OnInit(); }
83
84 // Called before OnRun(), this is a good place to do initialization -- if
85 // anything fails, return false from here to prevent the program from
86 // continuing. The command line is normally parsed here, call the base
87 // class OnInit() to do it.
88 virtual bool OnInit();
89
90 // this is here only temporary hopefully (FIXME)
91 virtual bool OnInitGui() { return true; }
92
93 // This is the replacement for the normal main(): all program work should
94 // be done here. When OnRun() returns, the programs starts shutting down.
95 virtual int OnRun() = 0;
96
97 // This is only called if OnInit() returned true so it's a good place to do
98 // any cleanup matching the initializations done there.
99 virtual int OnExit();
100
101 // This is the very last function called on wxApp object before it is
102 // destroyed. If you override it (instead of overriding OnExit() as usual)
103 // do not forget to call the base class version!
104 virtual void CleanUp();
105
106 // Called when a fatal exception occurs, this function should take care not
107 // to do anything which might provoke a nested exception! It may be
108 // overridden if you wish to react somehow in non-default way (core dump
109 // under Unix, application crash under Windows) to fatal program errors,
110 // however extreme care should be taken if you don't want this function to
111 // crash.
112 virtual void OnFatalException() { }
113
114 // Called from wxExit() function, should terminate the application a.s.a.p.
115 virtual void Exit();
116
117 // Return the layout direction for the current locale
118 virtual wxLayoutDirection GetLayoutDirection() const;
119
120
121 // application info: name, description, vendor
122 // -------------------------------------------
123
124 // NB: all these should be set by the application itself, there are no
125 // reasonable default except for the application name which is taken to
126 // be argv[0]
127
128 // set/get the application name
129 wxString GetAppName() const
130 {
131 return m_appName.empty() ? m_className : m_appName;
132 }
133 void SetAppName(const wxString& name) { m_appName = name; }
134
135 // set/get the app class name
136 wxString GetClassName() const { return m_className; }
137 void SetClassName(const wxString& name) { m_className = name; }
138
139 // set/get the vendor name
140 const wxString& GetVendorName() const { return m_vendorName; }
141 void SetVendorName(const wxString& name) { m_vendorName = name; }
142
143
144 // cmd line parsing stuff
145 // ----------------------
146
147 // all of these methods may be overridden in the derived class to
148 // customize the command line parsing (by default only a few standard
149 // options are handled)
150 //
151 // you also need to call wxApp::OnInit() from YourApp::OnInit() for all
152 // this to work
153
154 #if wxUSE_CMDLINE_PARSER
155 // this one is called from OnInit() to add all supported options
156 // to the given parser (don't forget to call the base class version if you
157 // override it!)
158 virtual void OnInitCmdLine(wxCmdLineParser& parser);
159
160 // called after successfully parsing the command line, return true
161 // to continue and false to exit (don't forget to call the base class
162 // version if you override it!)
163 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
164
165 // called if "--help" option was specified, return true to continue
166 // and false to exit
167 virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
168
169 // called if incorrect command line options were given, return
170 // false to abort and true to continue
171 virtual bool OnCmdLineError(wxCmdLineParser& parser);
172 #endif // wxUSE_CMDLINE_PARSER
173
174
175 // miscellaneous customization functions
176 // -------------------------------------
177
178 // create the app traits object to which we delegate for everything which
179 // either should be configurable by the user (then he can change the
180 // default behaviour simply by overriding CreateTraits() and returning his
181 // own traits object) or which is GUI/console dependent as then wxAppTraits
182 // allows us to abstract the differences behind the common façade
183 wxAppTraits *GetTraits();
184
185 // the functions below shouldn't be used now that we have wxAppTraits
186 #if WXWIN_COMPATIBILITY_2_4
187
188 #if wxUSE_LOG
189 // override this function to create default log target of arbitrary
190 // user-defined class (default implementation creates a wxLogGui
191 // object) -- this log object is used by default by all wxLogXXX()
192 // functions.
193 wxDEPRECATED( virtual wxLog *CreateLogTarget() );
194 #endif // wxUSE_LOG
195
196 // similar to CreateLogTarget() but for the global wxMessageOutput
197 // object
198 wxDEPRECATED( virtual wxMessageOutput *CreateMessageOutput() );
199
200 #endif // WXWIN_COMPATIBILITY_2_4
201
202
203 // event processing functions
204 // --------------------------
205
206 // this method allows to filter all the events processed by the program, so
207 // you should try to return quickly from it to avoid slowing down the
208 // program to the crawl
209 //
210 // return value should be -1 to continue with the normal event processing,
211 // or TRUE or FALSE to stop further processing and pretend that the event
212 // had been already processed or won't be processed at all, respectively
213 virtual int FilterEvent(wxEvent& event);
214
215 #if wxUSE_EXCEPTIONS
216 // call the specified handler on the given object with the given event
217 //
218 // this method only exists to allow catching the exceptions thrown by any
219 // event handler, it would lead to an extra (useless) virtual function call
220 // if the exceptions were not used, so it doesn't even exist in that case
221 virtual void HandleEvent(wxEvtHandler *handler,
222 wxEventFunction func,
223 wxEvent& event) const;
224
225 // Called when an unhandled C++ exception occurs inside OnRun(): note that
226 // the exception type is lost by now, so if you really want to handle the
227 // exception you should override OnRun() and put a try/catch around
228 // MainLoop() call there or use OnExceptionInMainLoop()
229 virtual void OnUnhandledException() { }
230 #endif // wxUSE_EXCEPTIONS
231
232 // process all events in the wxPendingEvents list -- it is necessary to
233 // call this function to process posted events. This happens during each
234 // event loop iteration in GUI mode but if there is no main loop, it may be
235 // also called directly.
236 virtual void ProcessPendingEvents();
237
238 // doesn't do anything in this class, just a hook for GUI wxApp
239 virtual bool Yield(bool WXUNUSED(onlyIfNeeded) = false) { return true; }
240
241 // make sure that idle events are sent again
242 virtual void WakeUpIdle() { }
243
244 // this is just a convenience: by providing its implementation here we
245 // avoid #ifdefs in the code using it
246 static bool IsMainLoopRunning() { return false; }
247
248
249 // debugging support
250 // -----------------
251
252 #ifdef __WXDEBUG__
253 // this function is called when an assert failure occurs, the base class
254 // version does the normal processing (i.e. shows the usual assert failure
255 // dialog box)
256 //
257 // the arguments are the location of the failed assert (func may be empty
258 // if the compiler doesn't support C99 __FUNCTION__), the text of the
259 // assert itself and the user-specified message
260 virtual void OnAssertFailure(const wxChar *file,
261 int line,
262 const wxChar *func,
263 const wxChar *cond,
264 const wxChar *msg);
265
266 // old version of the function without func parameter, for compatibility
267 // only, override OnAssertFailure() in the new code
268 virtual void OnAssert(const wxChar *file,
269 int line,
270 const wxChar *cond,
271 const wxChar *msg);
272 #endif // __WXDEBUG__
273
274 // check that the wxBuildOptions object (constructed in the application
275 // itself, usually the one from IMPLEMENT_APP() macro) matches the build
276 // options of the library and abort if it doesn't
277 static bool CheckBuildOptions(const char *optionsSignature,
278 const char *componentName);
279 #if WXWIN_COMPATIBILITY_2_4
280 wxDEPRECATED( static bool CheckBuildOptions(const wxBuildOptions& buildOptions) );
281 #endif
282
283 // implementation only from now on
284 // -------------------------------
285
286 // helpers for dynamic wxApp construction
287 static void SetInitializerFunction(wxAppInitializerFunction fn)
288 { ms_appInitFn = fn; }
289 static wxAppInitializerFunction GetInitializerFunction()
290 { return ms_appInitFn; }
291
292 // accessors for ms_appInstance field (external code might wish to modify
293 // it, this is why we provide a setter here as well, but you should really
294 // know what you're doing if you call it), wxTheApp is usually used instead
295 // of GetInstance()
296 static wxAppConsole *GetInstance() { return ms_appInstance; }
297 static void SetInstance(wxAppConsole *app) { ms_appInstance = app; }
298
299
300 // command line arguments (public for backwards compatibility)
301 int argc;
302 wxChar **argv;
303
304 protected:
305 // the function which creates the traits object when GetTraits() needs it
306 // for the first time
307 virtual wxAppTraits *CreateTraits();
308
309
310 // function used for dynamic wxApp creation
311 static wxAppInitializerFunction ms_appInitFn;
312
313 // the one and only global application object
314 static wxAppConsole *ms_appInstance;
315
316
317 // application info (must be set from the user code)
318 wxString m_vendorName, // vendor name (ACME Inc)
319 m_appName, // app name
320 m_className; // class name
321
322 // the class defining the application behaviour, NULL initially and created
323 // by GetTraits() when first needed
324 wxAppTraits *m_traits;
325
326
327 // the application object is a singleton anyhow, there is no sense in
328 // copying it
329 DECLARE_NO_COPY_CLASS(wxAppConsole)
330 };
331
332 // ----------------------------------------------------------------------------
333 // wxAppBase: the common part of wxApp implementations for all platforms
334 // ----------------------------------------------------------------------------
335
336 #if wxUSE_GUI
337
338 class WXDLLIMPEXP_CORE wxAppBase : public wxAppConsole
339 {
340 public:
341 wxAppBase();
342 virtual ~wxAppBase();
343
344 // the virtual functions which may/must be overridden in the derived class
345 // -----------------------------------------------------------------------
346
347 // very first initialization function
348 //
349 // Override: very rarely
350 virtual bool Initialize(int& argc, wxChar **argv);
351
352 // a platform-dependent version of OnInit(): the code here is likely to
353 // depend on the toolkit. default version does nothing.
354 //
355 // Override: rarely.
356 virtual bool OnInitGui();
357
358 // called to start program execution - the default version just enters
359 // the main GUI loop in which events are received and processed until
360 // the last window is not deleted (if GetExitOnFrameDelete) or
361 // ExitMainLoop() is called. In console mode programs, the execution
362 // of the program really starts here
363 //
364 // Override: rarely in GUI applications, always in console ones.
365 virtual int OnRun();
366
367 // a matching function for OnInit()
368 virtual int OnExit();
369
370 // very last clean up function
371 //
372 // Override: very rarely
373 virtual void CleanUp();
374
375
376 // the worker functions - usually not used directly by the user code
377 // -----------------------------------------------------------------
378
379 // return true if we're running main loop, i.e. if the events can
380 // (already) be dispatched
381 static bool IsMainLoopRunning()
382 {
383 wxAppBase *app = wx_static_cast(wxAppBase *, GetInstance());
384 return app && app->m_mainLoop != NULL;
385 }
386
387 // execute the main GUI loop, the function returns when the loop ends
388 virtual int MainLoop();
389
390 // exit the main loop thus terminating the application
391 virtual void Exit();
392
393 // exit the main GUI loop during the next iteration (i.e. it does not
394 // stop the program immediately!)
395 virtual void ExitMainLoop();
396
397 // returns true if there are unprocessed events in the event queue
398 virtual bool Pending();
399
400 // process the first event in the event queue (blocks until an event
401 // appears if there are none currently, use Pending() if this is not
402 // wanted), returns false if the event loop should stop and true
403 // otherwise
404 virtual bool Dispatch();
405
406 // process all currently pending events right now
407 //
408 // it is an error to call Yield() recursively unless the value of
409 // onlyIfNeeded is true
410 //
411 // WARNING: this function is dangerous as it can lead to unexpected
412 // reentrancies (i.e. when called from an event handler it
413 // may result in calling the same event handler again), use
414 // with _extreme_ care or, better, don't use at all!
415 virtual bool Yield(bool onlyIfNeeded = false) = 0;
416
417 // this virtual function is called in the GUI mode when the application
418 // becomes idle and normally just sends wxIdleEvent to all interested
419 // parties
420 //
421 // it should return true if more idle events are needed, false if not
422 virtual bool ProcessIdle();
423
424 // Send idle event to window and all subwindows
425 // Returns true if more idle time is requested.
426 virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
427
428
429 #if wxUSE_EXCEPTIONS
430 // Function called if an uncaught exception is caught inside the main
431 // event loop: it may return true to continue running the event loop or
432 // false to stop it (in the latter case it may rethrow the exception as
433 // well)
434 virtual bool OnExceptionInMainLoop();
435 #endif // wxUSE_EXCEPTIONS
436
437
438 // top level window functions
439 // --------------------------
440
441 // return true if our app has focus
442 virtual bool IsActive() const { return m_isActive; }
443
444 // set the "main" top level window
445 void SetTopWindow(wxWindow *win) { m_topWindow = win; }
446
447 // return the "main" top level window (if it hadn't been set previously
448 // with SetTopWindow(), will return just some top level window and, if
449 // there are none, will return NULL)
450 virtual wxWindow *GetTopWindow() const
451 {
452 if (m_topWindow)
453 return m_topWindow;
454 else if (wxTopLevelWindows.GetCount() > 0)
455 return wxTopLevelWindows.GetFirst()->GetData();
456 else
457 return (wxWindow *)NULL;
458 }
459
460 // control the exit behaviour: by default, the program will exit the
461 // main loop (and so, usually, terminate) when the last top-level
462 // program window is deleted. Beware that if you disable this behaviour
463 // (with SetExitOnFrameDelete(false)), you'll have to call
464 // ExitMainLoop() explicitly from somewhere.
465 void SetExitOnFrameDelete(bool flag)
466 { m_exitOnFrameDelete = flag ? Yes : No; }
467 bool GetExitOnFrameDelete() const
468 { return m_exitOnFrameDelete == Yes; }
469
470
471 // display mode, visual, printing mode, ...
472 // ------------------------------------------------------------------------
473
474 // Get display mode that is used use. This is only used in framebuffer
475 // wxWin ports (such as wxMGL or wxDFB).
476 virtual wxVideoMode GetDisplayMode() const { return wxVideoMode(); }
477 // Set display mode to use. This is only used in framebuffer wxWin
478 // ports (such as wxMGL or wxDFB). This method should be called from
479 // wxApp::OnInitGui
480 virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; }
481
482 // set use of best visual flag (see below)
483 void SetUseBestVisual( bool flag ) { m_useBestVisual = flag; }
484 bool GetUseBestVisual() const { return m_useBestVisual; }
485
486 // set/get printing mode: see wxPRINT_XXX constants.
487 //
488 // default behaviour is the normal one for Unix: always use PostScript
489 // printing.
490 virtual void SetPrintMode(int WXUNUSED(mode)) { }
491 int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }
492
493
494 // command line parsing (GUI-specific)
495 // ------------------------------------------------------------------------
496
497 #if wxUSE_CMDLINE_PARSER
498 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
499 virtual void OnInitCmdLine(wxCmdLineParser& parser);
500 #endif
501
502 // miscellaneous other stuff
503 // ------------------------------------------------------------------------
504
505 // called by toolkit-specific code to set the app status: active (we have
506 // focus) or not and also the last window which had focus before we were
507 // deactivated
508 virtual void SetActive(bool isActive, wxWindow *lastFocus);
509
510 #if WXWIN_COMPATIBILITY_2_6
511 // OBSOLETE: don't use, always returns true
512 //
513 // returns true if the program is successfully initialized
514 wxDEPRECATED( bool Initialized() );
515 #endif // WXWIN_COMPATIBILITY_2_6
516
517 // perform standard OnIdle behaviour, ensure that this is always called
518 void OnIdle(wxIdleEvent& event);
519
520
521 protected:
522 // delete all objects in wxPendingDelete list
523 void DeletePendingObjects();
524
525 // override base class method to use GUI traits
526 virtual wxAppTraits *CreateTraits();
527
528
529 // the main event loop of the application (may be NULL if the loop hasn't
530 // been started yet or has already terminated)
531 wxEventLoop *m_mainLoop;
532
533 // the main top level window (may be NULL)
534 wxWindow *m_topWindow;
535
536 // if Yes, exit the main loop when the last top level window is deleted, if
537 // No don't do it and if Later -- only do it once we reach our OnRun()
538 //
539 // the explanation for using this strange scheme is given in appcmn.cpp
540 enum
541 {
542 Later = -1,
543 No,
544 Yes
545 } m_exitOnFrameDelete;
546
547 // true if the app wants to use the best visual on systems where
548 // more than one are available (Sun, SGI, XFree86 4.0 ?)
549 bool m_useBestVisual;
550
551 // does any of our windows have focus?
552 bool m_isActive;
553
554
555 DECLARE_NO_COPY_CLASS(wxAppBase)
556 };
557
558 #if WXWIN_COMPATIBILITY_2_6
559 inline bool wxAppBase::Initialized() { return true; }
560 #endif // WXWIN_COMPATIBILITY_2_6
561
562 #endif // wxUSE_GUI
563
564 // ----------------------------------------------------------------------------
565 // now include the declaration of the real class
566 // ----------------------------------------------------------------------------
567
568 #if wxUSE_GUI
569 #if defined(__WXPALMOS__)
570 #include "wx/palmos/app.h"
571 #elif defined(__WXMSW__)
572 #include "wx/msw/app.h"
573 #elif defined(__WXMOTIF__)
574 #include "wx/motif/app.h"
575 #elif defined(__WXMGL__)
576 #include "wx/mgl/app.h"
577 #elif defined(__WXDFB__)
578 #include "wx/dfb/app.h"
579 #elif defined(__WXGTK20__)
580 #include "wx/gtk/app.h"
581 #elif defined(__WXGTK__)
582 #include "wx/gtk1/app.h"
583 #elif defined(__WXX11__)
584 #include "wx/x11/app.h"
585 #elif defined(__WXMAC__)
586 #include "wx/mac/app.h"
587 #elif defined(__WXCOCOA__)
588 #include "wx/cocoa/app.h"
589 #elif defined(__WXPM__)
590 #include "wx/os2/app.h"
591 #endif
592 #else // !GUI
593 // allow using just wxApp (instead of wxAppConsole) in console programs
594 typedef wxAppConsole wxApp;
595 #endif // GUI/!GUI
596
597 // ----------------------------------------------------------------------------
598 // the global data
599 // ----------------------------------------------------------------------------
600
601 // for compatibility, we define this macro to access the global application
602 // object of type wxApp
603 //
604 // note that instead of using of wxTheApp in application code you should
605 // consider using DECLARE_APP() after which you may call wxGetApp() which will
606 // return the object of the correct type (i.e. MyApp and not wxApp)
607 //
608 // the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in
609 // console mode it does nothing at all
610 #define wxTheApp ((wxApp *)wxApp::GetInstance())
611
612 // ----------------------------------------------------------------------------
613 // global functions
614 // ----------------------------------------------------------------------------
615
616 // event loop related functions only work in GUI programs
617 // ------------------------------------------------------
618
619 // Force an exit from main loop
620 extern void WXDLLIMPEXP_BASE wxExit();
621
622 // Yield to other apps/messages
623 extern bool WXDLLIMPEXP_BASE wxYield();
624
625 // Yield to other apps/messages
626 extern void WXDLLIMPEXP_BASE wxWakeUpIdle();
627
628 // ----------------------------------------------------------------------------
629 // macros for dynamic creation of the application object
630 // ----------------------------------------------------------------------------
631
632 // Having a global instance of this class allows wxApp to be aware of the app
633 // creator function. wxApp can then call this function to create a new app
634 // object. Convoluted, but necessary.
635
636 class WXDLLIMPEXP_BASE wxAppInitializer
637 {
638 public:
639 wxAppInitializer(wxAppInitializerFunction fn)
640 { wxApp::SetInitializerFunction(fn); }
641 };
642
643 // the code below defines a IMPLEMENT_WXWIN_MAIN macro which you can use if
644 // your compiler really, really wants main() to be in your main program (e.g.
645 // hello.cpp). Now IMPLEMENT_APP should add this code if required.
646
647 #define IMPLEMENT_WXWIN_MAIN_CONSOLE \
648 int main(int argc, char **argv) { return wxEntry(argc, argv); }
649
650 // port-specific header could have defined it already in some special way
651 #ifndef IMPLEMENT_WXWIN_MAIN
652 #define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE
653 #endif // defined(IMPLEMENT_WXWIN_MAIN)
654
655 #ifdef __WXUNIVERSAL__
656 #include "wx/univ/theme.h"
657
658 #define IMPLEMENT_WX_THEME_SUPPORT \
659 WX_USE_THEME(win32); \
660 WX_USE_THEME(gtk);
661 #else
662 #define IMPLEMENT_WX_THEME_SUPPORT
663 #endif
664
665 // Use this macro if you want to define your own main() or WinMain() function
666 // and call wxEntry() from there.
667 #define IMPLEMENT_APP_NO_MAIN(appname) \
668 wxAppConsole *wxCreateApp() \
669 { \
670 wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
671 "your program"); \
672 return new appname; \
673 } \
674 wxAppInitializer \
675 wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
676 DECLARE_APP(appname) \
677 appname& wxGetApp() { return *(appname *)wxTheApp; }
678
679 // Same as IMPLEMENT_APP() normally but doesn't include themes support in
680 // wxUniversal builds
681 #define IMPLEMENT_APP_NO_THEMES(appname) \
682 IMPLEMENT_APP_NO_MAIN(appname) \
683 IMPLEMENT_WXWIN_MAIN
684
685 // Use this macro exactly once, the argument is the name of the wxApp-derived
686 // class which is the class of your application.
687 #define IMPLEMENT_APP(appname) \
688 IMPLEMENT_APP_NO_THEMES(appname) \
689 IMPLEMENT_WX_THEME_SUPPORT
690
691 // Same as IMPLEMENT_APP(), but for console applications.
692 #define IMPLEMENT_APP_CONSOLE(appname) \
693 IMPLEMENT_APP_NO_MAIN(appname) \
694 IMPLEMENT_WXWIN_MAIN_CONSOLE
695
696 // this macro can be used multiple times and just allows you to use wxGetApp()
697 // function
698 #define DECLARE_APP(appname) extern appname& wxGetApp();
699
700
701 // declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed
702 // anywhere else but at the very least it suppresses icc warnings about
703 // defining extern symbols without prior declaration, and it shouldn't do any
704 // harm
705 extern wxAppConsole *wxCreateApp();
706 extern wxAppInitializer wxTheAppInitializer;
707
708 #endif // _WX_APP_H_BASE_