bool handled = false;
if ( ([event type] >= NSLeftMouseDown) && ([event type] <= NSMouseExited) )
{
+ WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent();
+ WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef();
+
wxWindow* cw = wxWindow::GetCapture();
if ( cw != NULL )
{
+ if (wxTheApp)
+ wxTheApp->MacSetCurrentEvent(event, NULL);
((wxWidgetCocoaImpl*)cw->GetPeer())->DoHandleMouseEvent( event);
handled = true;
}
+ else if ( [event type] == NSMouseMoved )
+ {
+ NSPoint nsPoint = [event locationInWindow];
+ if ( [event window] != nil )
+ nsPoint = [[event window] convertBaseToScreen:nsPoint];
+
+ wxPoint pt = wxFromNSPoint(NULL, nsPoint);
+ wxWindow* mw = ::wxFindWindowAtPoint(pt);
+ if ( mw )
+ {
+ if (wxTheApp)
+ wxTheApp->MacSetCurrentEvent(event, NULL);
+ ((wxWidgetCocoaImpl*)mw->GetPeer())->DoHandleMouseEvent( event);
+ handled = true;
+ }
+ }
+ if ( handled )
+ {
+ if (wxTheApp)
+ wxTheApp->MacSetCurrentEvent(formerEvent , formerHandler);
+ }
}
return handled;
}
- (void)sendEvent:(NSEvent *) event
{
if ( ![self WX_filterSendEvent: event] )
+ {
+ WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent();
+ WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef();
+
+ if (wxTheApp)
+ wxTheApp->MacSetCurrentEvent(event, NULL);
+
[super sendEvent: event];
+
+ if (wxTheApp)
+ wxTheApp->MacSetCurrentEvent(formerEvent , formerHandler);
+ }
}
@end
[editor release];
}
return editor;
- }
-
+ }
+
return nil;
}