]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved wxCocoa specific doIdle method to application delegate object
authorDavid Elliott <dfe@tgwbd.org>
Mon, 6 Oct 2003 17:12:43 +0000 (17:12 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Mon, 6 Oct 2003 17:12:43 +0000 (17:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24104 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/app.mm

index 2ee2c6bab8f69abeca77e7b9fa5738fdbb90e60b..54d1f422672b7423f26db2147f83695d8b385e1d 100644 (file)
@@ -49,7 +49,6 @@ wxPoseAsInitializer *wxPoseAsInitializer::sm_first = NULL;
 {
 }
 
-- (void)doIdle: (id)data;
 - (void)sendEvent: (NSEvent*)anEvent;
 @end // wxPoserNSApplication
 
@@ -57,6 +56,33 @@ WX_IMPLEMENT_POSER(wxPoserNSApplication);
 
 @implementation wxPoserNSApplication : NSApplication
 
+- (void)sendEvent: (NSEvent*)anEvent
+{
+    wxLogDebug("SendEvent");
+    wxTheApp->CocoaInstallRequestedIdleHandler();
+    [super sendEvent: anEvent];
+}
+
+@end // wxPoserNSApplication
+
+// ========================================================================
+// wxNSApplicationDelegate
+// ========================================================================
+@interface wxNSApplicationDelegate : NSObject
+{
+}
+
+- (void)doIdle: (id)data;
+// Delegate methods
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication;
+- (void)applicationWillBecomeActive:(NSNotification *)notification;
+- (void)applicationDidBecomeActive:(NSNotification *)notification;
+- (void)applicationWillResignActive:(NSNotification *)notification;
+- (void)applicationDidResignActive:(NSNotification *)notification;
+@end // interface wxNSApplicationDelegate : NSObject
+
+@implementation wxNSApplicationDelegate : NSObject
+
 - (void)doIdle: (id)data
 {
     wxASSERT(wxTheApp);
@@ -90,31 +116,6 @@ WX_IMPLEMENT_POSER(wxPoserNSApplication);
     wxTheApp->CocoaRequestIdle();
 }
 
-- (void)sendEvent: (NSEvent*)anEvent
-{
-    wxLogDebug("SendEvent");
-    wxTheApp->CocoaInstallRequestedIdleHandler();
-    [super sendEvent: anEvent];
-}
-
-@end // wxPoserNSApplication
-
-// ========================================================================
-// wxNSApplicationDelegate
-// ========================================================================
-@interface wxNSApplicationDelegate : NSObject
-{
-}
-
-- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication;
-- (void)applicationWillBecomeActive:(NSNotification *)notification;
-- (void)applicationDidBecomeActive:(NSNotification *)notification;
-- (void)applicationWillResignActive:(NSNotification *)notification;
-- (void)applicationDidResignActive:(NSNotification *)notification;
-@end // interface wxNSApplicationDelegate : NSObject
-
-@implementation wxNSApplicationDelegate : NSObject
-
 // NOTE: Terminate means that the event loop does NOT return and thus
 // cleanup code doesn't properly execute.  Furthermore, wxWindows has its
 // own exit on frame delete mechanism.
@@ -237,7 +238,7 @@ void wxApp::CocoaInstallIdleHandler()
     m_isIdle = false;
     // Call doIdle for EVERYTHING dammit
 // We'd need Foundation/NSConnection.h for this next constant, do we need it?
-    [[ NSRunLoop currentRunLoop ] performSelector:@selector(doIdle:) target:m_cocoaApp argument:NULL order:0 modes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, /* NSConnectionReplyRunLoopMode,*/ NSModalPanelRunLoopMode, /**/NSEventTrackingRunLoopMode,/**/ nil] ];
+    [[ NSRunLoop currentRunLoop ] performSelector:@selector(doIdle:) target:m_cocoaAppDelegate argument:NULL order:0 modes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, /* NSConnectionReplyRunLoopMode,*/ NSModalPanelRunLoopMode, /**/NSEventTrackingRunLoopMode,/**/ nil] ];
 }
 
 void wxApp::CocoaDelegate_applicationWillBecomeActive()
@@ -273,7 +274,7 @@ bool wxApp::OnInitGui()
 //    [ m_cocoaApp setDelegate:m_cocoaApp ];
     #if 0
     wxLogDebug("Just for kicks");
-    [ m_cocoaApp performSelector:@selector(doIdle:) withObject:NULL ];
+    [ m_cocoaAppDelegate performSelector:@selector(doIdle:) withObject:NULL ];
     wxLogDebug("okay.. done now");
     #endif
     return TRUE;