X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aad65f130d9cb77d0e9f2b7b580c54712386f77a..d1efca1a2ac2dd20d47d217ce2be1bcc506377e0:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 665e19c19a..2398dad313 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -42,6 +42,7 @@ #include "wx/confbase.h" #include "wx/tokenzr.h" #include "wx/utils.h" +#include "wx/msgout.h" #if wxUSE_GUI #include "wx/artprov.h" @@ -188,12 +189,34 @@ int wxAppBase::FilterEvent(wxEvent& WXUNUSED(event)) return -1; } +void wxAppBase::DoInit() +{ + if (wxMessageOutput::Get()) + return; + + // NB: The standard way of printing help on command line arguments (app --help) + // is (according to common practice): + // - console apps: to stderr (on any platform) + // - GUI apps: stderr on Unix platforms (!) + // message box under Windows and others +#if wxUSE_GUI && !defined(__UNIX__) + #ifdef __WXMOTIF__ + wxMessageOutput::Set(new wxMessageOutputLog); + #else + wxMessageOutput::Set(new wxMessageOutputMessageBox); + #endif +#else + wxMessageOutput::Set(new wxMessageOutputStderr); +#endif +} + // ---------------------------------------------------------------------------- // cmd line parsing // ---------------------------------------------------------------------------- bool wxAppBase::OnInit() { + DoInit(); #if wxUSE_CMDLINE_PARSER wxCmdLineParser parser(argc, argv);