* 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
This commit is contained in:
@@ -20,6 +20,13 @@
|
||||
#import <AppKit/NSColor.h>
|
||||
#import <AppKit/NSClipView.h>
|
||||
|
||||
// Turn this on to paint green over the dummy views for debugging
|
||||
#undef WXCOCOA_FILL_DUMMY_VIEW
|
||||
|
||||
#ifdef WXCOCOA_FILL_DUMMY_VIEW
|
||||
#import <AppKit/NSBezierPath.h>
|
||||
#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
|
||||
// ========================================================================
|
||||
|
Reference in New Issue
Block a user