///////////////////////////////////////////////////////////////////////////////
-// Name: mac/carbon/evtloop.cpp
+// Name: src/mac/carbon/evtloop.cpp
// Purpose: implementation of wxEventLoop for wxMac
// Author: Vadim Zeitlin
// Modified by:
#include "wx/evtloop.h"
-#include <Carbon/Carbon.h>
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+#endif // WX_PRECOMP
+#ifdef __DARWIN__
+ #include <Carbon/Carbon.h>
+#else
+ #include <Carbon.h>
+#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;
) == 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
wxTheApp->MacDoOneEvent();
return true;
}
-