+#if wxUSE_GUI
+ #if defined(__WXMSW__)
+ #include "wx/msw/app.h"
+ #elif defined(__WXMOTIF__)
+ #include "wx/motif/app.h"
+ #elif defined(__WXMGL__)
+ #include "wx/mgl/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();
+
+// Post a message to the given eventhandler which will be processed during the
+// next event loop iteration
+inline void wxPostEvent(wxEvtHandler *dest, wxEvent& event)
+{
+ wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") );
+
+#if wxUSE_GUI
+ dest->AddPendingEvent(event);
+#else
+ dest->ProcessEvent(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();
+
+// create an object of this class on stack to initialize/cleanup thel ibrary
+// automatically
+class WXDLLEXPORT wxInitializer
+{
+public:
+ // initialize the library
+ wxInitializer() { m_ok = wxInitialize(); }
+
+ // has the initialization been successful? (explicit test)
+ bool IsOk() const { return m_ok; }
+
+ // has the initialization been successful? (implicit test)
+ operator bool() const { return m_ok; }
+
+ // dtor only does clean up if we initialized the library properly
+ ~wxInitializer() { if ( m_ok ) wxUninitialize(); }
+
+private:
+ bool m_ok;
+};
+
+#endif // !wxUSE_GUI