void AssociateNSWindow(WX_NSWindow cocoaNSWindow);
void DisassociateNSWindow(WX_NSWindow cocoaNSWindow);
virtual void Cocoa_close(void) = 0;
+ virtual bool Cocoa_canBecomeMainWindow(bool &canBecome)
+ { return false; }
virtual bool CocoaDelegate_windowShouldClose(void) = 0;
virtual void CocoaDelegate_windowDidBecomeKey(void) { }
virtual void CocoaDelegate_windowDidResignKey(void) { }
+ virtual void CocoaDelegate_windowDidBecomeMain(void) { }
+ virtual void CocoaDelegate_windowDidResignMain(void) { }
protected:
static struct objc_object *sm_cocoaDelegate;
};
- (void)windowDidBecomeKey: (NSNotification *)notification;
- (void)windowDidResignKey: (NSNotification *)notification;
+- (void)windowDidBecomeMain: (NSNotification *)notification;
+- (void)windowDidResignMain: (NSNotification *)notification;
- (BOOL)windowShouldClose: (id)sender;
@end //interface wxNSWindowDelegate
win->CocoaDelegate_windowDidResignKey();
}
+- (void)windowDidBecomeMain: (NSNotification *)notification
+{
+ wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
+ wxCHECK_RET(win,"notificationDidBecomeMain received but no wxWindow exists");
+ win->CocoaDelegate_windowDidBecomeMain();
+}
+
+- (void)windowDidResignMain: (NSNotification *)notification
+{
+ wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
+ wxCHECK_RET(win,"notificationDidResignMain received but no wxWindow exists");
+ win->CocoaDelegate_windowDidResignMain();
+}
+
- (BOOL)windowShouldClose: (id)sender
{
wxLogDebug("windowShouldClose");
}
- (void)close;
+- (BOOL)canBecomeMainWindow;
@end // wxPoserNSwindow
WX_IMPLEMENT_POSER(wxPoserNSWindow);
[super close];
}
+- (BOOL)canBecomeMainWindow
+{
+ bool canBecome = false;
+ wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(self);
+ if(!tlw || !tlw->Cocoa_canBecomeMainWindow(canBecome))
+ canBecome = [super canBecomeMainWindow];
+ return canBecome;
+}
+
@end // implementation wxPoserNSWindow