X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/715e4f7e3e26595209b5fe8a9ad3e60cce317e5f..d642db66a5efc82d374b813022c72ba88bc50839:/include/wx/app.h diff --git a/include/wx/app.h b/include/wx/app.h index 4b0c4fbc9d..a0fe4afee1 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -18,6 +18,7 @@ // ---------------------------------------------------------------------------- #include "wx/event.h" // for the base class +#include "wx/eventfilter.h" // (and another one) #include "wx/build.h" #include "wx/cmdargs.h" // for wxCmdLineArgsArray used by wxApp::argv #include "wx/init.h" // we must declare wxEntry() @@ -70,7 +71,8 @@ extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; // wxAppConsoleBase: wxApp for non-GUI applications // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxAppConsoleBase : public wxEvtHandler +class WXDLLIMPEXP_BASE wxAppConsoleBase : public wxEvtHandler, + public wxEventFilter { public: // ctor and dtor @@ -234,17 +236,24 @@ public: wxEventLoopBase* GetMainLoop() const { return m_mainLoop; } + // This function sets the C locale to the default locale for the current + // environment. It is advised to call this to ensure that the underlying + // toolkit uses the locale in which the numbers and monetary amounts are + // shown in the format expected by user and so on. + // + // Notice that this does _not_ change the global C++ locale, you need to do + // it explicitly if you want. + // + // Finally, notice that while this function is virtual, it is not supposed + // to be overridden outside of the library itself. + virtual void SetCLocale(); + // event processing functions // -------------------------- - // 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 + // Implement the inherited wxEventFilter method but just return -1 from it + // to indicate that default processing should take place. virtual int FilterEvent(wxEvent& event); // return true if we're running event loop, i.e. if the events can @@ -497,7 +506,7 @@ protected: wxDECLARE_NO_COPY_CLASS(wxAppConsoleBase); }; -#if defined(__UNIX__) && !defined(__CYGWIN__) +#if defined(__UNIX__) && !defined(__WXMSW__) #include "wx/unix/app.h" #else // this has to be a class and not a typedef as we forward declare it @@ -562,10 +571,6 @@ public: // it should return true if more idle events are needed, false if not virtual bool ProcessIdle(); - // Send idle event to window and all subwindows - // Returns true if more idle time is requested. - virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event); - // override base class version: GUI apps always use an event loop virtual bool UsesEventLoop() const { return true; } @@ -599,10 +604,10 @@ public: // ------------------------------------------------------------------------ // Get display mode that is used use. This is only used in framebuffer - // wxWin ports (such as wxMGL or wxDFB). + // wxWin ports such as wxDFB. virtual wxVideoMode GetDisplayMode() const; // Set display mode to use. This is only used in framebuffer wxWin - // ports (such as wxMGL or wxDFB). This method should be called from + // ports such as wxDFB. This method should be called from // wxApp::OnInitGui virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; } @@ -688,14 +693,10 @@ protected: // now include the declaration of the real class // ---------------------------------------------------------------------------- -#if defined(__WXPALMOS__) - #include "wx/palmos/app.h" -#elif defined(__WXMSW__) +#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(__WXDFB__) #include "wx/dfb/app.h" #elif defined(__WXGTK20__) @@ -777,13 +778,26 @@ public: // your compiler really, really wants main() to be in your main program (e.g. // hello.cpp). Now wxIMPLEMENT_APP should add this code if required. -#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \ - int main(int argc, char **argv) \ - { \ - wxDISABLE_DEBUG_SUPPORT(); \ +// For compilers that support it, prefer to use wmain() as this ensures any +// Unicode strings can be passed as command line parameters and not just those +// representable in the current locale. +#if wxUSE_UNICODE && defined(__VISUALC__) + #define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \ + int wmain(int argc, wchar_t **argv) \ + { \ + wxDISABLE_DEBUG_SUPPORT(); \ \ - return wxEntry(argc, argv); \ - } + return wxEntry(argc, argv); \ + } +#else // Use standard main() + #define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \ + int main(int argc, char **argv) \ + { \ + wxDISABLE_DEBUG_SUPPORT(); \ + \ + return wxEntry(argc, argv); \ + } +#endif // port-specific header could have defined it already in some special way #ifndef wxIMPLEMENT_WXWIN_MAIN @@ -806,6 +820,7 @@ public: // Use this macro if you want to define your own main() or WinMain() function // and call wxEntry() from there. #define wxIMPLEMENT_APP_NO_MAIN(appname) \ + appname& wxGetApp() { return *static_cast(wxApp::GetInstance()); } \ wxAppConsole *wxCreateApp() \ { \ wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ @@ -813,9 +828,7 @@ public: return new appname; \ } \ wxAppInitializer \ - wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ - appname& wxGetApp() { return *static_cast(wxApp::GetInstance()); } \ - wxDECLARE_APP(appname) + wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp) // Same as wxIMPLEMENT_APP() normally but doesn't include themes support in // wxUniversal builds