+ // Get display mode that is used use. This is only used in framebuffer wxWin ports
+ // (such as wxMGL).
+ virtual wxDisplayModeInfo GetDisplayMode() const { return wxDisplayModeInfo(); }
+ // Set display mode to use. This is only used in framebuffer wxWin ports
+ // (such as wxMGL). This method should be called from wxApp:OnInitGui
+ virtual bool SetDisplayMode(const wxDisplayModeInfo& WXUNUSED(info)) { return TRUE; }
+
+ // set use of best visual flag (see below)
+ void SetUseBestVisual( bool flag ) { m_useBestVisual = flag; }
+ bool GetUseBestVisual() const { return m_useBestVisual; }
+
+ // set/get printing mode: see wxPRINT_XXX constants.
+ //
+ // default behaviour is the normal one for Unix: always use PostScript
+ // printing.
+ virtual void SetPrintMode(int WXUNUSED(mode)) { }
+ int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }
+
+ // called by toolkit-specific code to set the app status: active (we have
+ // focus) or not and also the last window which had focus before we were
+ // deactivated
+ virtual void SetActive(bool isActive, wxWindow *lastFocus);
+#endif // wxUSE_GUI
+
+ // this method allows to filter all the events processed by the program, so
+ // you should try to return quickly from it to avoid slowing down the
+ // program to the crawl
+ //
+ // return value should be -1 to continue with the normal event processing,
+ // or TRUE or FALSE to stop further processing and pretend that the event
+ // had been already processed or won't be processed at all, respectively
+ virtual int FilterEvent(wxEvent& event);
+
+ // debugging support
+ // -----------------
+
+ // this function is called when an assert failure occurs, the base class
+ // version does the normal processing (i.e. shows the usual assert failure
+ // dialog box)
+ //
+ // the arguments are the place where the assert occured, the text of the
+ // assert itself and the user-specified message
+#ifdef __WXDEBUG__
+ virtual void OnAssert(const wxChar *file,
+ int line,
+ const wxChar *cond,
+ const wxChar *msg);
+#endif // __WXDEBUG__
+
+ // check that the wxBuildOptions object (constructed in the application
+ // itself, usually the one from IMPLEMENT_APP() macro) matches the build
+ // options of the library and abort if it doesn't
+ static bool CheckBuildOptions(const wxBuildOptions& buildOptions);
+
+ // deprecated functions, please updae your code to not use them!
+ // -------------------------------------------------------------
+
+#if WXWIN_COMPATIBILITY_2_2
+ // used by obsolete wxDebugMsg only
+ void SetWantDebugOutput( bool flag ) { m_wantDebugOutput = flag; }
+ bool GetWantDebugOutput() const { return m_wantDebugOutput; }
+
+ // TRUE if the application wants to get debug output
+ bool m_wantDebugOutput;
+#endif // WXWIN_COMPATIBILITY_2_2
+
+ // implementation only from now on
+ // -------------------------------
+
+ // helpers for dynamic wxApp construction
+ static void SetInitializerFunction(wxAppInitializerFunction fn)
+ { m_appInitFn = fn; }
+ static wxAppInitializerFunction GetInitializerFunction()
+ { return m_appInitFn; }
+
+ // process all events in the wxPendingEvents list
+ virtual void ProcessPendingEvents();
+
+ // access to the command line arguments
+ int argc;
+ wxChar **argv;
+
+protected:
+ // function used for dynamic wxApp creation
+ static wxAppInitializerFunction m_appInitFn;
+
+ // application info (must be set from the user code)
+ wxString m_vendorName, // vendor name (ACME Inc)
+ m_appName, // app name
+ m_className; // class name
+
+#if wxUSE_GUI
+ // the main top level window - may be NULL
+ wxWindow *m_topWindow;
+
+ // if Yes, exit the main loop when the last top level window is deleted, if
+ // No don't do it and if Later -- only do it once we reach our OnRun()
+ //
+ // the explanation for using this strange scheme is given in appcmn.cpp
+ enum
+ {
+ Later = -1,
+ No,
+ Yes
+ } m_exitOnFrameDelete;
+
+ // TRUE if the apps whats to use the best visual on systems where
+ // more than one are available (Sun, SGI, XFree86 4.0 ?)
+ bool m_useBestVisual;
+
+ // does any of our windows has focus?
+ bool m_isActive;
+#endif // wxUSE_GUI
+};
+
+// ----------------------------------------------------------------------------
+// now include the declaration of the real class
+// ----------------------------------------------------------------------------
+
+#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(__WXGTK__)
+ #include "wx/gtk/app.h"
+ #elif defined(__WXX11__)
+ #include "wx/x11/app.h"
+ #elif defined(__WXMAC__)
+ #include "wx/mac/app.h"
+ #elif defined(__WXCOCOA__)
+ #include "wx/cocoa/app.h"
+ #elif defined(__WXPM__)
+ #include "wx/os2/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
+
+// ----------------------------------------------------------------------------
+// macros for dynamic creation of the application object
+// ----------------------------------------------------------------------------
+
+// Having a global instance of this class allows wxApp to be aware of the app
+// creator function. wxApp can then call this function to create a new app
+// object. Convoluted, but necessary.