]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement windowShouldClose: in delegate instead of class poser
authorDavid Elliott <dfe@tgwbd.org>
Fri, 29 Aug 2003 14:15:59 +0000 (14:15 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Fri, 29 Aug 2003 14:15:59 +0000 (14:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/NSWindow.mm

index cd1c735fafaafc4f718497c47574341bfa273f65..4bf6ef9a76946c799dc8dae82126a2245c30aa07 100644 (file)
@@ -39,6 +39,7 @@
 
 - (void)windowDidBecomeKey: (NSNotification *)notification;
 - (void)windowDidResignKey: (NSNotification *)notification;
+- (BOOL)windowShouldClose: (id)sender;
 @end //interface wxNSWindowDelegate
 
 @implementation wxNSWindowDelegate : NSObject
     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