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:
@@ -49,7 +49,6 @@ wxPoseAsInitializer *wxPoseAsInitializer::sm_first = NULL;
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)doIdle: (id)data;
|
|
||||||
- (void)sendEvent: (NSEvent*)anEvent;
|
- (void)sendEvent: (NSEvent*)anEvent;
|
||||||
@end // wxPoserNSApplication
|
@end // wxPoserNSApplication
|
||||||
|
|
||||||
@@ -57,6 +56,33 @@ WX_IMPLEMENT_POSER(wxPoserNSApplication);
|
|||||||
|
|
||||||
@implementation wxPoserNSApplication : NSApplication
|
@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
|
- (void)doIdle: (id)data
|
||||||
{
|
{
|
||||||
wxASSERT(wxTheApp);
|
wxASSERT(wxTheApp);
|
||||||
@@ -90,31 +116,6 @@ WX_IMPLEMENT_POSER(wxPoserNSApplication);
|
|||||||
wxTheApp->CocoaRequestIdle();
|
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
|
// NOTE: Terminate means that the event loop does NOT return and thus
|
||||||
// cleanup code doesn't properly execute. Furthermore, wxWindows has its
|
// cleanup code doesn't properly execute. Furthermore, wxWindows has its
|
||||||
// own exit on frame delete mechanism.
|
// own exit on frame delete mechanism.
|
||||||
@@ -237,7 +238,7 @@ void wxApp::CocoaInstallIdleHandler()
|
|||||||
m_isIdle = false;
|
m_isIdle = false;
|
||||||
// Call doIdle for EVERYTHING dammit
|
// Call doIdle for EVERYTHING dammit
|
||||||
// We'd need Foundation/NSConnection.h for this next constant, do we need it?
|
// 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()
|
void wxApp::CocoaDelegate_applicationWillBecomeActive()
|
||||||
@@ -273,7 +274,7 @@ bool wxApp::OnInitGui()
|
|||||||
// [ m_cocoaApp setDelegate:m_cocoaApp ];
|
// [ m_cocoaApp setDelegate:m_cocoaApp ];
|
||||||
#if 0
|
#if 0
|
||||||
wxLogDebug("Just for kicks");
|
wxLogDebug("Just for kicks");
|
||||||
[ m_cocoaApp performSelector:@selector(doIdle:) withObject:NULL ];
|
[ m_cocoaAppDelegate performSelector:@selector(doIdle:) withObject:NULL ];
|
||||||
wxLogDebug("okay.. done now");
|
wxLogDebug("okay.. done now");
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Reference in New Issue
Block a user