X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf9e3e736771b247eb38ada221266733b6a601c7..84bfc0d503636bd4f64699d7b1bf45e201d787ff:/include/wx/app.h diff --git a/include/wx/app.h b/include/wx/app.h index cad0b66264..5538e053bd 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -21,7 +21,7 @@ // typedefs // ---------------------------------------------------------------------------- -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined (__WXPM__) class WXDLLEXPORT wxApp; typedef wxApp* (*wxAppInitializerFunction)(); #else @@ -215,6 +215,10 @@ public: void SetWantDebugOutput( bool flag ) { m_wantDebugOutput = flag; } bool GetWantDebugOutput() const { return m_wantDebugOutput; } + // 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 @@ -255,6 +259,10 @@ protected: // TRUE if the application wants to get debug output bool m_wantDebugOutput; + // 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; + #if wxUSE_GUI // the main top level window - may be NULL wxWindow *m_topWindow; @@ -282,7 +290,10 @@ protected: #include "wx/stubs/app.h" #endif #else // !GUI - typedef wxAppBase wxApp; + // can't use typedef because wxApp forward declared as a class + class WXDLLEXPORT wxApp : public wxAppBase + { + }; #endif // GUI/!GUI // ---------------------------------------------------------------------------- @@ -302,18 +313,14 @@ WXDLLEXPORT_DATA(extern wxApp*) wxTheApp; // event loop related functions only work in GUI programs // ------------------------------------------------------ -#if wxUSE_GUI - // Force an exit from main loop extern void WXDLLEXPORT wxExit(); // Yield to other apps/messages extern bool WXDLLEXPORT wxYield(); -#ifdef __WXGTK__ // Yield to other apps/messages extern void WXDLLEXPORT wxWakeUpIdle(); -#endif // Post a message to the given eventhandler which will be processed during the // next event loop iteration @@ -321,16 +328,18 @@ inline void WXDLLEXPORT 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_NOGUI +#if !wxUSE_GUI // initialize the library (may be called as many times as needed, but each // call to wxInitialize() must be matched by wxUninitialize()) @@ -340,7 +349,7 @@ extern bool WXDLLEXPORT wxInitialize(); // wxUninitialize() extern void WXDLLEXPORT wxUninitialize(); -#endif // wxUSE_NOGUI +#endif // !wxUSE_GUI // ---------------------------------------------------------------------------- // macros for dynamic creation of the application object @@ -361,41 +370,47 @@ public: // be in your main program (e.g. hello.cpp). Now IMPLEMENT_APP should add this // code if required. -#if defined(__AIX__) || defined(__HPUX__) || defined( __VMS__ ) +#if !wxUSE_GUI || defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) #define IMPLEMENT_WXWIN_MAIN \ extern int wxEntry( int argc, char *argv[] ); \ int main(int argc, char *argv[]) { return wxEntry(argc, argv); } #elif defined(__WXMSW__) && defined(WXUSINGDLL) // NT defines APIENTRY, 3.x not #if !defined(WXAPIENTRY) - #ifdef __WATCOMC__ - #define WXAPIENTRY PASCAL - #else - #define WXAPIENTRY FAR PASCAL - #endif + #define WXAPIENTRY WXFAR wxSTDCALL #endif + #include + #include "wx/msw/winundef.h" + #define IMPLEMENT_WXWIN_MAIN \ - int WXAPIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,\ - LPSTR m_lpCmdLine, int nCmdShow )\ + extern "C" int WXAPIENTRY WinMain(HINSTANCE hInstance,\ + HINSTANCE hPrevInstance,\ + LPSTR m_lpCmdLine, int nCmdShow)\ {\ - return wxEntry((WXHINSTANCE) hInstance, \ + return wxEntry((WXHINSTANCE) hInstance,\ (WXHINSTANCE) hPrevInstance,\ m_lpCmdLine, nCmdShow);\ } - #else #define IMPLEMENT_WXWIN_MAIN #endif -// use this macro exactly once, the argument is the name of the wxApp-derived -// class which is the class of your application -#define IMPLEMENT_APP(appname) \ - wxApp *wxCreateApp() { return new appname; } \ +// Use this macro exactly once, the argument is the name of the wxApp-derived +// class which is the class of your application. +#define IMPLEMENT_APP(appname) \ + wxApp *wxCreateApp() { return new appname; } \ wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ appname& wxGetApp() { return *(appname *)wxTheApp; } \ IMPLEMENT_WXWIN_MAIN +// Use this macro if you want to define your own main() or WinMain() function +// and call wxEntry() from there. +#define IMPLEMENT_APP_NO_MAIN(appname) \ + wxApp *wxCreateApp() { return new appname; } \ + wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ + appname& wxGetApp() { return *(appname *)wxTheApp; } + #define DECLARE_APP(appname) extern appname& wxGetApp(); #endif