X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96d38c7e0df2138cff3505dbba7d93111254ba5f..991d57f8443fc8a31c2ad3e3a8180af08a6394d6:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index dddd390ab5..d78a126972 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: common/appcmn.cpp +// Name: src/common/appcmn.cpp // Purpose: wxAppConsole and wxAppBase methods common to all platforms // Author: Vadim Zeitlin // Modified by: @@ -17,10 +17,6 @@ // headers // --------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "appbase.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -65,7 +61,7 @@ WX_CHECK_BUILD_OPTIONS("wxCore") // ---------------------------------------------------------------------------- // this defines wxEventLoopPtr -wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoop); +wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoop) // ============================================================================ // wxAppBase implementation @@ -81,9 +77,7 @@ wxAppBase::wxAppBase() m_useBestVisual = false; m_isActive = true; -#if wxUSE_EVTLOOP_IN_APP m_mainLoop = NULL; -#endif // wxUSE_EVTLOOP_IN_APP // We don't want to exit the app if the user code shows a dialog from its // OnInit() -- but this is what would happen if we set m_exitOnFrameDelete @@ -100,9 +94,9 @@ wxAppBase::wxAppBase() m_exitOnFrameDelete = Later; } -bool wxAppBase::Initialize(int& argc, wxChar **argv) +bool wxAppBase::Initialize(int& argcOrig, wxChar **argvOrig) { - if ( !wxAppConsole::Initialize(argc, argv) ) + if ( !wxAppConsole::Initialize(argcOrig, argvOrig) ) return false; #if wxUSE_THREADS @@ -110,7 +104,6 @@ bool wxAppBase::Initialize(int& argc, wxChar **argv) #endif wxInitializeStockLists(); - wxInitializeStockObjects(); wxBitmap::InitStandardHandlers(); @@ -143,7 +136,7 @@ void wxAppBase::CleanUp() // undo everything we did in Initialize() above wxBitmap::CleanUpHandlers(); - wxDeleteStockObjects(); + wxStockGDI::DeleteAll(); wxDeleteStockLists(); @@ -266,51 +259,37 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) int wxAppBase::MainLoop() { -#if wxUSE_EVTLOOP_IN_APP wxEventLoopTiedPtr mainLoop(&m_mainLoop, new wxEventLoop); return m_mainLoop->Run(); -#else // !wxUSE_EVTLOOP_IN_APP - return 0; -#endif // wxUSE_EVTLOOP_IN_APP/!wxUSE_EVTLOOP_IN_APP } void wxAppBase::ExitMainLoop() { -#if wxUSE_EVTLOOP_IN_APP // we should exit from the main event loop, not just any currently active // (e.g. modal dialog) event loop if ( m_mainLoop && m_mainLoop->IsRunning() ) { m_mainLoop->Exit(0); } -#endif // wxUSE_EVTLOOP_IN_APP } bool wxAppBase::Pending() { -#if wxUSE_EVTLOOP_IN_APP // use the currently active message loop here, not m_mainLoop, because if // we're showing a modal dialog (with its own event loop) currently the // main event loop is not running anyhow wxEventLoop * const loop = wxEventLoop::GetActive(); return loop && loop->Pending(); -#else // wxUSE_EVTLOOP_IN_APP - return false; -#endif // wxUSE_EVTLOOP_IN_APP/!wxUSE_EVTLOOP_IN_APP } bool wxAppBase::Dispatch() { -#if wxUSE_EVTLOOP_IN_APP // see comment in Pending() wxEventLoop * const loop = wxEventLoop::GetActive(); return loop && loop->Dispatch(); -#else // wxUSE_EVTLOOP_IN_APP - return true; -#endif // wxUSE_EVTLOOP_IN_APP/!wxUSE_EVTLOOP_IN_APP } // ---------------------------------------------------------------------------- @@ -376,6 +355,10 @@ void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus)) (void)ProcessEvent(event); } +// ---------------------------------------------------------------------------- +// idle handling +// ---------------------------------------------------------------------------- + void wxAppBase::DeletePendingObjects() { wxList::compatibility_iterator node = wxPendingDelete.GetFirst(); @@ -467,6 +450,24 @@ void wxAppBase::OnIdle(wxIdleEvent& WXUNUSED(event)) } +// ---------------------------------------------------------------------------- +// exceptions support +// ---------------------------------------------------------------------------- + +#if wxUSE_EXCEPTIONS + +bool wxAppBase::OnExceptionInMainLoop() +{ + throw; + + // some compilers are too stupid to know that we never return after throw +#if defined(__DMC__) || (defined(_MSC_VER) && _MSC_VER < 1200) + return false; +#endif +} + +#endif // wxUSE_EXCEPTIONS + // ---------------------------------------------------------------------------- // wxGUIAppTraitsBase // ---------------------------------------------------------------------------- @@ -585,13 +586,13 @@ void wxGUIAppTraitsBase::RemoveFromPendingDelete(wxObject *object) #elif defined(__UNIX__) || defined(__DARWIN__) || defined(__OS2__) #include "wx/unix/gsockunx.h" #elif defined(__WXMAC__) - #include - #define OTUNIXERRORS 1 - #include - #include - #include + #include + #define OTUNIXERRORS 1 + #include + #include + #include - #include "wx/mac/gsockmac.h" + #include "wx/mac/gsockmac.h" #else #error "Must include correct GSocket header here" #endif @@ -609,4 +610,3 @@ GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable() } #endif -