From c05e07cb8c5a4e4baa29369a49fd87ac0f1ea3a9 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Fri, 23 Sep 2005 15:27:42 +0000 Subject: [PATCH] Added Cocoa_acceptsFirstMouse. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cocoa/NSView.h | 2 ++ src/cocoa/NSView.mm | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/wx/cocoa/NSView.h b/include/wx/cocoa/NSView.h index 50a583c5d2..7fb9c79dd1 100644 --- a/include/wx/cocoa/NSView.h +++ b/include/wx/cocoa/NSView.h @@ -32,6 +32,8 @@ public: virtual wxWindow* GetWxWindow() const { return NULL; } virtual void Cocoa_FrameChanged(void) = 0; + virtual bool Cocoa_acceptsFirstMouse(bool &acceptsFirstMouse, WX_NSEvent theEvent) + { return false; } virtual bool Cocoa_drawRect(const NSRect &rect) { return false; } virtual bool Cocoa_mouseDown(WX_NSEvent theEvent) diff --git a/src/cocoa/NSView.mm b/src/cocoa/NSView.mm index 364fa03059..72c6899868 100644 --- a/src/cocoa/NSView.mm +++ b/src/cocoa/NSView.mm @@ -79,6 +79,15 @@ void wxCocoaNSView::DisassociateNSView(WX_NSView cocoaNSView) WX_IMPLEMENT_POSER(wxPoserNSView); @implementation wxPoserNSView : NSView +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent +{ + bool acceptsFirstMouse = false; + wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self); + if(!win || !win->Cocoa_acceptsFirstMouse(acceptsFirstMouse, theEvent)) + acceptsFirstMouse = [super acceptsFirstMouse:theEvent]; + return acceptsFirstMouse; +} + - (void)drawRect: (NSRect)rect { wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self); -- 2.47.2