X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7a8691eec8df150c13d64593c2200cd1ba83c2d4..5a1e0e91a1ca5ec98b0eeb335cda757d1261ed08:/src/cocoa/NSWindow.mm diff --git a/src/cocoa/NSWindow.mm b/src/cocoa/NSWindow.mm index 653229e78e..7152f6c47b 100644 --- a/src/cocoa/NSWindow.mm +++ b/src/cocoa/NSWindow.mm @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: cocoa/NSWindow.mm +// Name: src/cocoa/NSWindow.mm // Purpose: wxCocoaNSWindow // Author: David Elliott // Modified by: // Created: 2003/03/16 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWindows license +// Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -23,12 +23,11 @@ #include "wx/menuitem.h" #endif // WX_PRECOMP -#include "wx/cocoa/ObjcPose.h" #include "wx/cocoa/NSWindow.h" -#import #import #import +#include "wx/cocoa/objc/NSWindow.h" // ============================================================================ // @class wxNSWindowDelegate @@ -149,8 +148,8 @@ WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSWindow) -wxCocoaNSWindow::wxCocoaNSWindow(wxTopLevelWindow *tlw) -: m_wxTopLevelWindow(tlw) +wxCocoaNSWindow::wxCocoaNSWindow(wxTopLevelWindowCocoa *tlw) +: m_wxTopLevelWindowCocoa(tlw) { m_cocoaDelegate = [[wxNSWindowDelegate alloc] init]; [m_cocoaDelegate setWxCocoaInterface: this]; @@ -187,17 +186,43 @@ wxMenuBar* wxCocoaNSWindow::GetAppMenuBar(wxCocoaNSWindow *win) } // ============================================================================ -// @class wxPoserNSWindow +// @class WXNSWindow // ============================================================================ -@interface wxPoserNSWindow : NSWindow +@implementation WXNSWindow : NSWindow + +- (BOOL)canBecomeKeyWindow { + bool canBecome = false; + wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(self); + if(!tlw || !tlw->Cocoa_canBecomeKeyWindow(canBecome)) + canBecome = [super canBecomeKeyWindow]; + return canBecome; +} + +- (BOOL)canBecomeMainWindow +{ + bool canBecome = false; + wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(self); + if(!tlw || !tlw->Cocoa_canBecomeMainWindow(canBecome)) + canBecome = [super canBecomeMainWindow]; + return canBecome; } -- (BOOL)canBecomeMainWindow; -@end // wxPoserNSwindow +@end // implementation WXNSWindow -WX_IMPLEMENT_POSER(wxPoserNSWindow); -@implementation wxPoserNSWindow : NSWindow +// ============================================================================ +// @class WXNSPanel +// ============================================================================ +@implementation WXNSPanel : NSPanel + +- (BOOL)canBecomeKeyWindow +{ + bool canBecome = false; + wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(self); + if(!tlw || !tlw->Cocoa_canBecomeKeyWindow(canBecome)) + canBecome = [super canBecomeKeyWindow]; + return canBecome; +} - (BOOL)canBecomeMainWindow { @@ -208,5 +233,4 @@ WX_IMPLEMENT_POSER(wxPoserNSWindow); return canBecome; } -@end // implementation wxPoserNSWindow - +@end // implementation WXNSPanel