trying to support non-wx controls on a window
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28327 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
aa99e0cd22
commit
d88ffaaa76
@ -424,7 +424,8 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
|
|||||||
short windowPart = ::FindWindow(screenMouseLocation, &window);
|
short windowPart = ::FindWindow(screenMouseLocation, &window);
|
||||||
|
|
||||||
wxWindow* currentMouseWindow = NULL ;
|
wxWindow* currentMouseWindow = NULL ;
|
||||||
|
ControlRef control = NULL ;
|
||||||
|
|
||||||
if ( window )
|
if ( window )
|
||||||
{
|
{
|
||||||
QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ;
|
QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ;
|
||||||
@ -436,14 +437,15 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
|
|||||||
else if ( (IsWindowActive(window) && windowPart == inContent) )
|
else if ( (IsWindowActive(window) && windowPart == inContent) )
|
||||||
{
|
{
|
||||||
ControlPartCode part ;
|
ControlPartCode part ;
|
||||||
ControlRef control = wxMacFindControlUnderMouse( windowMouseLocation , window , &part ) ;
|
control = wxMacFindControlUnderMouse( windowMouseLocation , window , &part ) ;
|
||||||
|
// if there is no control below the mouse position, send the event to the toplevel window itself
|
||||||
if ( control == 0 )
|
if ( control == 0 )
|
||||||
currentMouseWindow = (wxWindow*) data ;
|
currentMouseWindow = (wxWindow*) data ;
|
||||||
else
|
else
|
||||||
currentMouseWindow = wxFindControlFromMacControl( control ) ;
|
currentMouseWindow = wxFindControlFromMacControl( control ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
|
wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
|
||||||
SetupMouseEvent( wxevent , cEvent ) ;
|
SetupMouseEvent( wxevent , cEvent ) ;
|
||||||
|
|
||||||
@ -549,6 +551,29 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
|
|||||||
// update cursor ?
|
// update cursor ?
|
||||||
}
|
}
|
||||||
} // else if ( currentMouseWindow )
|
} // else if ( currentMouseWindow )
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// don't mess with controls we don't know about
|
||||||
|
// for some reason returning eventNotHandledErr does not lead to the correct behaviour
|
||||||
|
// so we try sending them the correct control directly
|
||||||
|
wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
|
||||||
|
if ( toplevelWindow && control )
|
||||||
|
{
|
||||||
|
EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
|
||||||
|
Point clickLocation = windowMouseLocation ;
|
||||||
|
#if TARGET_API_MAC_OSX
|
||||||
|
HIPoint hiPoint ;
|
||||||
|
hiPoint.x = clickLocation.h ;
|
||||||
|
hiPoint.y = clickLocation.v ;
|
||||||
|
HIViewConvertPoint( &hiPoint , (ControlRef) toplevelWindow->GetHandle() , control ) ;
|
||||||
|
clickLocation.h = (int)hiPoint.x ;
|
||||||
|
clickLocation.v = (int)hiPoint.y ;
|
||||||
|
#endif
|
||||||
|
HandleControlClick( control , clickLocation ,
|
||||||
|
modifiers , (ControlActionUPP ) -1 ) ;
|
||||||
|
result = noErr ;
|
||||||
|
}
|
||||||
|
}
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user