- wxCHECK_RET(win,"notificationDidBecomeKey received but no wxWindow exists");
- win->CocoaNotification_DidBecomeKey();
+ wxCHECK_RET(win,wxT("notificationDidBecomeMain received but no wxWindow exists"));
+ win->CocoaDelegate_windowDidBecomeMain();
+}
+
+- (void)windowDidResignMain: (NSNotification *)notification
+{
+ wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
+ wxCHECK_RET(win,wxT("notificationDidResignMain received but no wxWindow exists"));
+ win->CocoaDelegate_windowDidResignMain();
+}
+
+- (BOOL)windowShouldClose: (id)sender
+{
+ wxLogDebug(wxT("windowShouldClose"));
+ wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(sender);
+ if(tlw && !tlw->CocoaDelegate_windowShouldClose())
+ {
+ wxLogDebug(wxT("Window will not be closed"));
+ return NO;
+ }
+ wxLogDebug(wxT("Window will be closed"));
+ return YES;