]> git.saurik.com Git - wxWidgets.git/commitdiff
* Use a subclass of NSView for the dummy view which overrides hitTest: to
authorDavid Elliott <dfe@tgwbd.org>
Wed, 20 Aug 2003 14:45:48 +0000 (14:45 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Wed, 20 Aug 2003 14:45:48 +0000 (14:45 +0000)
  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

index 759671ac120f24c1402104c3f716e6185fbc54f9..79179167741c5074f6a8abdc33cfc11ead8d7331 100644 (file)
 #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
 // ========================================================================