+ 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 )
+ {
+ if ( m_modalWindow->GetParent() == NULL )
+ {
+ windowGroup = GetWindowGroup(m_modalNativeWindow) ;
+ if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) )
+ {
+ formerParentGroup = GetWindowGroupParent( windowGroup );
+ SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
+ resetGroupParent = true;
+ }
+ }
+ }
+
+ m_modalWindow->SetFocus();
+
+ RunAppModalLoopForWindow(m_modalNativeWindow);
+
+ if ( resetGroupParent )