-#if wxUSE_THREADS
- // Yielding from a non-gui thread needs to bail out, otherwise we end up
- // possibly sending events in the thread too.
- if ( !wxThread::IsMain() )
+ wxMacAutoreleasePool autoreleasepool;
+ RunApplicationEventLoop();
+}
+
+void wxGUIEventLoop::DoStop()
+{
+ QuitApplicationEventLoop();
+}
+
+CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const
+{
+ return wxCFEventLoop::CFGetCurrentRunLoop();
+}
+
+// TODO move into a evtloop_osx.cpp
+
+wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow)
+{
+ m_modalWindow = wxDynamicCast(modalWindow, wxNonOwnedWindow);
+ wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
+ m_modalNativeWindow = m_modalWindow->GetWXWindow();
+}
+
+wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow)
+{
+ m_modalWindow = NULL;
+ wxASSERT_MSG( modalNativeWindow != NULL, "must pass in a toplevel window for modal event loop" );
+ m_modalNativeWindow = modalNativeWindow;
+}
+
+// END move into a evtloop_osx.cpp
+
+void wxModalEventLoop::DoRun()
+{
+ wxWindowDisabler disabler(m_modalWindow);
+ wxMacAutoreleasePool autoreleasepool;
+
+ bool resetGroupParent = false;
+
+ WindowGroupRef windowGroup = NULL;
+ WindowGroupRef formerParentGroup = NULL;
+
+ // make sure modal dialogs are in the right layer so that they are not covered
+ if ( m_modalWindow != NULL )