Moved wxCocoa specific doIdle method to application delegate object
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24104 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b01fc8925f
commit
ba808e2412
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user