]> git.saurik.com Git - wxWidgets.git/commitdiff
Add a tracking rect on resize so that the view will receive mouse entered and exited...
authorKevin Ollivier <kevino@theolliviers.com>
Sat, 14 Feb 2009 08:00:43 +0000 (08:00 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Sat, 14 Feb 2009 08:00:43 +0000 (08:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/window.mm

index 25cc1c2858e11b62db663d6c47eb4756f22e9489..940e9839a2263ba75cdf6ac89e18278315024392 100644 (file)
@@ -44,9 +44,13 @@ NSRect wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const
 
 @interface wxNSView : NSView
 {
+    NSTrackingRectTag rectTag;
 }
 
 - (BOOL) canBecomeKeyView;
+// the tracking tag is needed to track mouse enter / exit events 
+- (void) setTrackingTag: (NSTrackingRectTag)tag;
+- (NSTrackingRectTag) trackingTag;
 
 @end // wxNSView
 
@@ -365,6 +369,16 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEvent )
     return YES;
 }
 
+- (void) setTrackingTag: (NSTrackingRectTag)tag
+{
+    rectTag = tag;
+}
+
+- (NSTrackingRectTag) trackingTag
+{
+    return rectTag;
+}
+
 @end // wxNSView
 
 //
@@ -959,6 +973,14 @@ void wxWidgetCocoaImpl::Move(int x, int y, int width, int height)
     }
     NSRect r = wxToNSRect( [m_osxView superview], wxRect(x,y,width, height) );
     [m_osxView setFrame:r];
+    
+    if ([[m_osxView respondsToSelector:@selector(trackingTag)] )
+    {
+        if ( [(wxNSView*)m_osxView trackingTag] )
+            [m_osxView removeTrackingRect: [(wxNSView*)m_osxView trackingTag]];
+        
+        [(wxNSView*)m_osxView setTrackingTag: [m_osxView addTrackingRect: [m_osxView bounds] owner: m_osxView userData: nil assumeInside: NO]];
+    }
 }
 
 void wxWidgetCocoaImpl::GetPosition( int &x, int &y ) const