]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/iphone/evtloop.mm
use new call
[wxWidgets.git] / src / osx / iphone / evtloop.mm
index 67e4784965945b5d4c733fae2c0df6ccff7cc2c9..0477771765bc9a1e467c33f15176e5579ec6d23e 100644 (file)
 
 #include "wx/log.h"
 
+#if wxUSE_GUI
+    #include "wx/nonownedwnd.h"
+#endif
+
 #include "wx/osx/private.h"
 
 // ============================================================================
@@ -77,24 +81,56 @@ 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();
+}
+// TODO move into a evtloop_osx.cpp
 
-    if ( event == nil )
-        return -1;
+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();
+}
 
-    [NSApp sendEvent: event];
-*/
-    return 1;
+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
 }