X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/24e78d272a133ca96b6b096366dcd6d9bca6f11e..dad5f99acb6b3400ff73562c03db2f3f21b658cd:/include/wx/app.h diff --git a/include/wx/app.h b/include/wx/app.h index 4756689918..1e555d402d 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -31,6 +31,8 @@ typedef wxObject* (*wxAppInitializerFunction)(); #endif +class WXDLLEXPORT wxCmdLineParser; + // ---------------------------------------------------------------------------- // headers we have to include here // ---------------------------------------------------------------------------- @@ -38,7 +40,7 @@ #include "wx/event.h" // for the base class #if wxUSE_GUI - #include "wx/window.h" // for wxTopLevelWindows + #include "wx/window.h" // for wxTopLevelWindows #endif // wxUSE_GUI #if wxUSE_LOG @@ -63,19 +65,16 @@ public: // the virtual functions which may/must be overridden in the derived class // ----------------------------------------------------------------------- -#ifdef __WXMAC_X__ - virtual ~wxAppBase() {} // Added min for Mac X +#ifdef __DARWIN__ + virtual ~wxAppBase() { } #endif + // called during the program initialization, returning FALSE from here // prevents the program from continuing - it's a good place to create // the top level program window and return TRUE. // // Override: always in GUI application, rarely in console ones. -#if wxUSE_GUI - virtual bool OnInit() { return FALSE; }; -#else // !GUI - virtual bool OnInit() { return TRUE; }; -#endif // wxUSE_GUI + virtual bool OnInit(); #if wxUSE_GUI // a platform-dependent version of OnInit(): the code here is likely to @@ -196,6 +195,34 @@ public: #endif // wxUSE_GUI + // cmd line parsing stuff + // ---------------------- + + // all of these methods may be overridden in the derived class to + // customize the command line parsing (by default only a few standard + // options are handled) + // + // you also need to call wxApp::OnInit() from YourApp::OnInit() for all + // this to work + +#if wxUSE_CMDLINE_PARSER + // this one is called from OnInit() to add all supported options + // to the given parser + virtual void OnInitCmdLine(wxCmdLineParser& parser); + + // called after successfully parsing the command line, return TRUE + // to continue and FALSE to exit + virtual bool OnCmdLineParsed(wxCmdLineParser& parser); + + // called if "--help" option was specified, return TRUE to continue + // and FALSE to exit + virtual bool OnCmdLineHelp(wxCmdLineParser& parser); + + // called if incorrect command line options were given, return + // FALSE to abort and TRUE to continue + virtual bool OnCmdLineError(wxCmdLineParser& parser); +#endif // wxUSE_CMDLINE_PARSER + // miscellaneous customization functions // ------------------------------------- @@ -239,6 +266,16 @@ public: virtual void SetActive(bool isActive, wxWindow *lastFocus); #endif // wxUSE_GUI + // 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) +#ifdef __WXDEBUG__ + virtual void OnAssert(const wxChar *file, int line, const wxChar *msg); +#endif // __WXDEBUG__ + // implementation only from now on // ------------------------------- @@ -412,7 +449,7 @@ public: extern int wxEntry( int argc, char *argv[] ); \ int main(int argc, char *argv[]) { return wxEntry(argc, argv); } #elif defined(__WXMAC__) && defined(__UNIX__) - // wxMac seems to have a specific wxEntry prototype + // wxMac seems to have a specific wxEntry prototype #define IMPLEMENT_WXWIN_MAIN \ extern int wxEntry( int argc, char *argv[], bool enterLoop = 1 ); \ int main(int argc, char *argv[]) { return wxEntry(argc, argv); }