From eb3426e77ac0ec2abcaae3f6f20d6f1068100d9f Mon Sep 17 00:00:00 2001 From: David Elliott Date: Fri, 29 Aug 2003 14:15:59 +0000 Subject: [PATCH] Implement windowShouldClose: in delegate instead of class poser git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/cocoa/NSWindow.mm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/cocoa/NSWindow.mm b/src/cocoa/NSWindow.mm index cd1c735faf..4bf6ef9a76 100644 --- a/src/cocoa/NSWindow.mm +++ b/src/cocoa/NSWindow.mm @@ -39,6 +39,7 @@ - (void)windowDidBecomeKey: (NSNotification *)notification; - (void)windowDidResignKey: (NSNotification *)notification; +- (BOOL)windowShouldClose: (id)sender; @end //interface wxNSWindowDelegate @implementation wxNSWindowDelegate : NSObject @@ -57,6 +58,19 @@ win->CocoaNotification_DidResignKey(); } +- (BOOL)windowShouldClose: (id)sender +{ + wxLogDebug("windowShouldClose"); + wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(sender); + if(tlw && !tlw->Cocoa_windowShouldClose()) + { + wxLogDebug("Window will not be closed"); + return NO; + } + wxLogDebug("Window will be closed"); + return YES; +} + @end //implementation wxNSWindowDelegate // ============================================================================ @@ -94,8 +108,6 @@ void wxCocoaNSWindow::DisassociateNSWindow(WX_NSWindow cocoaNSWindow) } - (void)close; -- (BOOL)windowShouldClose: (id)sender; - @end // wxPoserNSwindow WX_IMPLEMENT_POSER(wxPoserNSWindow); @@ -110,17 +122,5 @@ WX_IMPLEMENT_POSER(wxPoserNSWindow); [super close]; } -- (BOOL)windowShouldClose: (id)sender -{ - wxLogDebug("windowShouldClose"); - wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(sender); - if(tlw && !tlw->Cocoa_windowShouldClose()) - return NO; - wxLogDebug("Window will most likely be CLOSED"); - if([[wxPoserNSWindow superclass] instancesRespondToSelector:@selector(windowShouldClose:)]) - return [super windowShouldClose: sender]; - return YES; -} - @end // implementation wxPoserNSWindow -- 2.45.2