]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/evtloop.mm
Fix bug with using uninitialized flags in GetParentForModalDialog().
[wxWidgets.git] / src / osx / cocoa / evtloop.mm
index 4771978ff4c325710c5c818f25dae9ab7568c28a..bcd24e8405fd41e84156e860d81b92046094a5ae 100644 (file)
@@ -175,6 +175,24 @@ void wxGUIEventLoop::DoStop()
     [NSApp stop:0];
 }
 
+// TODO move into a evtloop_osx.cpp
+
+wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow)
+{
+    m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (modalWindow);
+    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()
 {
     wxMacAutoreleasePool pool;
@@ -191,8 +209,7 @@ void wxModalEventLoop::DoRun()
         }
     }
     
-    NSWindow* theWindow = m_modalWindow->GetWXWindow();
-    [NSApp runModalForWindow:theWindow];
+    [NSApp runModalForWindow:m_modalNativeWindow];
 }
 
 void wxModalEventLoop::DoStop()