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