X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf06fbce415a5b923de735aae3fe306619268594..cdc48273b49b0b90d9587a1ecc5935d38a160620:/src/osx/cocoa/evtloop.mm diff --git a/src/osx/cocoa/evtloop.mm b/src/osx/cocoa/evtloop.mm index 4771978ff4..bcd24e8405 100644 --- a/src/osx/cocoa/evtloop.mm +++ b/src/osx/cocoa/evtloop.mm @@ -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 (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()