Add a tracking rect on resize so that the view will receive mouse entered and exited events.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Ollivier
2009-02-14 08:00:43 +00:00
parent 22b476f1ce
commit fc09949561

View 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