X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0056673c672ab444863c57344936c9a322124df6..3678169caab0f713415414dce013a638305f3cce:/src/osx/iphone/evtloop.mm?ds=sidebyside diff --git a/src/osx/iphone/evtloop.mm b/src/osx/iphone/evtloop.mm index 67e4784965..8986ef5fa3 100644 --- a/src/osx/iphone/evtloop.mm +++ b/src/osx/iphone/evtloop.mm @@ -4,7 +4,7 @@ // Author: Vadim Zeitlin, Stefan Csomor // Modified by: // Created: 2006-01-12 -// RCS-ID: $Id: evtloop.cpp 54845 2008-07-30 14:52:41Z SC $ +// RCS-ID: $Id$ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -32,6 +32,10 @@ #include "wx/log.h" +#if wxUSE_GUI + #include "wx/nonownedwnd.h" +#endif + #include "wx/osx/private.h" // ============================================================================ @@ -77,24 +81,67 @@ static int CalculateUIEventMaskFromEventCategory(wxEventCategory cat) wxGUIEventLoop::wxGUIEventLoop() { - m_sleepTime = 0.0; +} + +void wxGUIEventLoop::DoRun() +{ + if ( IsMain() ) + { + wxMacAutoreleasePool pool; + const char* appname = "app"; + UIApplicationMain( 1, (char**) &appname, nil, @"wxAppDelegate" ); + } + else + { + wxCFEventLoop::DoRun(); + } } int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) { - wxMacAutoreleasePool autoreleasepool; + return wxCFEventLoop::DoDispatchTimeout(timeout); +} -/* - UIEvent *event = [[UIApplication sharedApplication] - nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate dateWithTimeIntervalSinceNow: timeout/1000] - inMode:NSDefaultRunLoopMode - dequeue: YES]; +void wxGUIEventLoop::DoStop() +{ + return wxCFEventLoop::DoStop(); +} - if ( event == nil ) - return -1; +CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const +{ + return wxCFEventLoop::CFGetCurrentRunLoop(); +} - [NSApp sendEvent: event]; -*/ - return 1; +void wxGUIEventLoop::WakeUp() +{ + return wxCFEventLoop::WakeUp(); +} + +// 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() +{ + // presentModalViewController:animated: +} + +void wxModalEventLoop::DoStop() +{ + // (void)dismissModalViewControllerAnimated:(BOOL)animated }