-#if defined(__WXMSW__)
- #include "wx/msw/app.h"
-#elif defined(__WXMOTIF__)
- #include "wx/motif/app.h"
-#elif defined(__WXQT__)
- #include "wx/qt/app.h"
-#elif defined(__WXGTK__)
- #include "wx/gtk/app.h"
-#elif defined(__WXMAC__)
- #include "wx/mac/app.h"
-#elif defined(__WXSTUBS__)
- #include "wx/stubs/app.h"
-#endif
+#if wxUSE_GUI
+ #if defined(__WXMSW__)
+ #include "wx/msw/app.h"
+ #elif defined(__WXMOTIF__)
+ #include "wx/motif/app.h"
+ #elif defined(__WXQT__)
+ #include "wx/qt/app.h"
+ #elif defined(__WXGTK__)
+ #include "wx/gtk/app.h"
+ #elif defined(__WXMAC__)
+ #include "wx/mac/app.h"
+ #elif defined(__WXPM__)
+ #include "wx/os2/app.h"
+ #elif defined(__WXSTUBS__)
+ #include "wx/stubs/app.h"
+ #endif
+#else // !GUI
+ // can't use typedef because wxApp forward declared as a class
+ class WXDLLEXPORT wxApp : public wxAppBase
+ {
+ };
+#endif // GUI/!GUI
+
+// ----------------------------------------------------------------------------
+// the global data
+// ----------------------------------------------------------------------------
+
+// the one and only application object - use of wxTheApp in application code
+// is discouraged, consider using DECLARE_APP() after which you may call
+// wxGetApp() which will return the object of the correct type (i.e. MyApp and
+// not wxApp)
+WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+// event loop related functions only work in GUI programs
+// ------------------------------------------------------
+
+// Force an exit from main loop
+extern void WXDLLEXPORT wxExit();
+
+// Yield to other apps/messages
+extern bool WXDLLEXPORT wxYield();
+
+// Yield to other apps/messages
+extern void WXDLLEXPORT wxWakeUpIdle();
+
+#if wxUSE_GUI
+
+// Post a message to the given eventhandler which will be processed during the
+// next event loop iteration
+inline void WXDLLEXPORT wxPostEvent(wxEvtHandler *dest, wxEvent& event)
+{
+ wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") );
+
+ dest->AddPendingEvent(event);
+}
+
+#endif // wxUSE_GUI
+
+// console applications may avoid using DECLARE_APP and IMPLEMENT_APP macros
+// and call these functions instead at the program startup and termination
+// -------------------------------------------------------------------------
+
+#if !wxUSE_GUI
+
+// initialize the library (may be called as many times as needed, but each
+// call to wxInitialize() must be matched by wxUninitialize())
+extern bool WXDLLEXPORT wxInitialize();
+
+// clean up - the library can't be used any more after the last call to
+// wxUninitialize()
+extern void WXDLLEXPORT wxUninitialize();
+
+#endif // !wxUSE_GUI