// 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 <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "wx/log.h"
+#if wxUSE_GUI
+ #include "wx/nonownedwnd.h"
+#endif
+
#include "wx/osx/private.h"
// ============================================================================
}
*/
-@interface wxAppDelegate : NSObject <UIApplicationDelegate> {
+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<wxNonOwnedWindow*> (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
+}