From 75e4856bba2ae491a6e90c93fa148fab7bea2435 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Wed, 20 Aug 2003 14:45:48 +0000 Subject: [PATCH] * Use a subclass of NSView for the dummy view which overrides hitTest: to return nil. That tells Cocoa never to send it any mouse events. * Set the autoresizingMask of the hidden view on the dummy view * Added some code to paint green over the dummy view. It makes debugging some things easier. Change the #undef WXCOCOA_FILL_DUMMY_VIEW to enable. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/cocoa/window.mm | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index 759671ac12..7917916774 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -20,6 +20,13 @@ #import #import +// Turn this on to paint green over the dummy views for debugging +#undef WXCOCOA_FILL_DUMMY_VIEW + +#ifdef WXCOCOA_FILL_DUMMY_VIEW +#import +#endif //def WXCOCOA_FILL_DUMMY_VIEW + // ======================================================================== // wxWindowCocoaHider // ======================================================================== @@ -34,6 +41,9 @@ protected: wxWindowCocoa *m_owner; WX_NSView m_dummyNSView; virtual void Cocoa_FrameChanged(void); +#ifdef WXCOCOA_FILL_DUMMY_VIEW + virtual bool Cocoa_drawRect(const NSRect& rect); +#endif //def WXCOCOA_FILL_DUMMY_VIEW private: wxWindowCocoaHider(); }; @@ -60,6 +70,21 @@ private: wxWindowCocoaScroller(); }; +// ======================================================================== +// wxDummyNSView +// ======================================================================== +@interface wxDummyNSView : NSView +- (NSView *)hitTest:(NSPoint)aPoint; +@end + +@implementation wxDummyNSView : NSView +- (NSView *)hitTest:(NSPoint)aPoint +{ + return nil; +} + +@end + // ======================================================================== // wxWindowCocoaHider // ======================================================================== @@ -68,8 +93,9 @@ wxWindowCocoaHider::wxWindowCocoaHider(wxWindow *owner) { wxASSERT(owner); wxASSERT(owner->GetNSViewForHiding()); - m_dummyNSView = [[NSView alloc] + m_dummyNSView = [[wxDummyNSView alloc] initWithFrame:[owner->GetNSViewForHiding() frame]]; + [m_dummyNSView setAutoresizingMask: [owner->GetNSViewForHiding() autoresizingMask]]; AssociateNSView(m_dummyNSView); } @@ -86,6 +112,17 @@ void wxWindowCocoaHider::Cocoa_FrameChanged(void) [m_owner->GetNSViewForHiding() setFrame:[m_dummyNSView frame]]; } +#ifdef WXCOCOA_FILL_DUMMY_VIEW +bool wxWindowCocoaHider::Cocoa_drawRect(const NSRect& rect) +{ + NSBezierPath *bezpath = [NSBezierPath bezierPathWithRect:rect]; + [[NSColor greenColor] set]; + [bezpath stroke]; + [bezpath fill]; + return true; +} +#endif //def WXCOCOA_FILL_DUMMY_VIEW + // ======================================================================== // wxFlippedNSClipView // ======================================================================== -- 2.45.2