From: Stefan Csomor Date: Tue, 23 Jul 2013 17:57:05 +0000 (+0000) Subject: adding OnLaunched X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b8f0ac88a51be909c0e5b87657ea0a5dc9bbb721?ds=sidebyside adding OnLaunched git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/app.h b/include/wx/app.h index b2d11cce40..445bdcb8dc 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -103,6 +103,9 @@ public: // be done here. When OnRun() returns, the programs starts shutting down. virtual int OnRun(); + // Called before the first events are handled, called from within MainLoop() + virtual void OnLaunched(); + // This is called by wxEventLoopBase::SetActive(): you should put the code // which needs an active event loop here. // Note that this function is called whenever an event loop is activated; diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index b8cba4ff88..f1c8918afe 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -256,6 +256,10 @@ int wxAppConsoleBase::OnRun() return MainLoop(); } +void wxAppConsoleBase::OnLaunched() +{ +} + int wxAppConsoleBase::OnExit() { #if wxUSE_CONFIG @@ -321,6 +325,13 @@ int wxAppConsoleBase::MainLoop() { wxEventLoopBaseTiedPtr mainLoop(&m_mainLoop, CreateMainLoop()); +#if defined(__WXOSX__) && wxOSX_USE_COCOA_OR_IPHONE + // OnLaunched called from native app controller +#else + if (wxTheApp) + wxTheApp->OnLaunched(); +#endif + return m_mainLoop ? m_mainLoop->Run() : -1; }