X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/80eee8378f6b6e8b9ecae46062c2b66ff4469f48..9e9574fe45b176ee74bba8fad7574cf9906145d1:/src/osx/iphone/evtloop.mm?ds=inline diff --git a/src/osx/iphone/evtloop.mm b/src/osx/iphone/evtloop.mm index ca463a6dcf..f928274e41 100644 --- a/src/osx/iphone/evtloop.mm +++ b/src/osx/iphone/evtloop.mm @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin, Stefan Csomor // Modified by: // Created: 2006-01-12 -// RCS-ID: $Id: evtloop.cpp 54845 2008-07-30 14:52:41Z SC $ // Copyright: (c) 2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -32,6 +31,10 @@ #include "wx/log.h" +#if wxUSE_GUI + #include "wx/nonownedwnd.h" +#endif + #include "wx/osx/private.h" // ============================================================================ @@ -75,43 +78,69 @@ static int CalculateUIEventMaskFromEventCategory(wxEventCategory cat) } */ -@interface wxAppDelegate : NSObject { +wxGUIEventLoop::wxGUIEventLoop() +{ } -@end +void wxGUIEventLoop::OSXDoRun() +{ + if ( IsMain() ) + { + wxMacAutoreleasePool pool; + const char* appname = "app"; + UIApplicationMain( 1, (char**) &appname, nil, @"wxAppDelegate" ); + } + else + { + wxCFEventLoop::OSXDoRun(); + } +} -@implementation wxAppDelegate +int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) +{ + return wxCFEventLoop::DoDispatchTimeout(timeout); +} -- (void)applicationDidFinishLaunching:(UIApplication *)application { - wxTheApp->OnInit(); +void wxGUIEventLoop::OSXDoStop() +{ + return wxCFEventLoop::OSXDoStop(); } -- (void)applicationWillTerminate:(UIApplication *)application { - wxCloseEvent event; - wxTheApp->OnEndSession(event); +CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const +{ + return wxCFEventLoop::CFGetCurrentRunLoop(); } -- (void)dealloc { - [super dealloc]; +void wxGUIEventLoop::WakeUp() +{ + return wxCFEventLoop::WakeUp(); } -@end +// TODO move into a evtloop_osx.cpp -wxGUIEventLoop::wxGUIEventLoop() +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(); } -void wxGUIEventLoop::DoRun() +wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow) { - if ( IsMain() ) - { - wxMacAutoreleasePool pool; - const char* appname = "app"; - UIApplicationMain( 1, (char**) &appname, nil, @"wxAppDelegate" ); - } - else - { - wxCFEventLoop::DoRun(); - } + 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::OSXDoRun() +{ + // presentModalViewController:animated: +} + +void wxModalEventLoop::OSXDoStop() +{ + // (void)dismissModalViewControllerAnimated:(BOOL)animated +}