X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d90072c22f3f7aff3991ef3187c67b2cdc5ea70..9d5507f7a2701395e1d5c121bd877bb9066ee6ea:/src/mac/carbon/evtloop.cpp?ds=sidebyside diff --git a/src/mac/carbon/evtloop.cpp b/src/mac/carbon/evtloop.cpp index cfe38c8b4c..681564bffa 100644 --- a/src/mac/carbon/evtloop.cpp +++ b/src/mac/carbon/evtloop.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: mac/carbon/evtloop.cpp +// Name: src/mac/carbon/evtloop.cpp // Purpose: implementation of wxEventLoop for wxMac // Author: Vadim Zeitlin // Modified by: @@ -26,48 +26,63 @@ #include "wx/evtloop.h" -#include +#ifndef WX_PRECOMP + #include "wx/app.h" +#endif // WX_PRECOMP +#ifdef __DARWIN__ + #include +#else + #include +#endif // ============================================================================ -// implementation +// wxEventLoop implementation // ============================================================================ -wxEventLoop::wxEventLoop() -{ - m_exitcode = 0; -#if !wxMAC_USE_RUN_APP_EVENT_LOOP - m_shouldExit = false; -#endif -} +// ---------------------------------------------------------------------------- +// high level functions for RunApplicationEventLoop() case +// ---------------------------------------------------------------------------- -int wxEventLoop::Run() +#if wxMAC_USE_RUN_APP_EVENT_LOOP + +int wxGUIEventLoop::Run() { wxEventLoopActivator activate(this); -#if wxMAC_USE_RUN_APP_EVENT_LOOP RunApplicationEventLoop(); -#else // manual event loop - while ( !m_shouldExit ) - { - Dispatch(); - } -#endif // auto/manual event loop return m_exitcode; } -void wxEventLoop::Exit(int rc) +void wxGUIEventLoop::Exit(int rc) { m_exitcode = rc; -#if wxMAC_USE_RUN_APP_EVENT_LOOP QuitApplicationEventLoop(); + + OnExit(); +} + #else // manual event loop - m_shouldExit = true; -#endif // auto/manual event loop + +// ---------------------------------------------------------------------------- +// functions only used by wxEventLoopManual-based implementation +// ---------------------------------------------------------------------------- + +void wxGUIEventLoop::WakeUp() +{ + extern void wxMacWakeUp(); + + wxMacWakeUp(); } -bool wxEventLoop::Pending() const +#endif // high/low-level event loop + +// ---------------------------------------------------------------------------- +// low level functions used in both cases +// ---------------------------------------------------------------------------- + +bool wxGUIEventLoop::Pending() const { EventRef theEvent; @@ -81,7 +96,7 @@ bool wxEventLoop::Pending() const ) == noErr; } -bool wxEventLoop::Dispatch() +bool wxGUIEventLoop::Dispatch() { // TODO: we probably should do the dispatching directly from here but for // now it's easier to forward to wxApp which has all the code to do @@ -92,4 +107,3 @@ bool wxEventLoop::Dispatch() wxTheApp->MacDoOneEvent(); return true; } -