making implementation independent of a wx-peer of that control

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2005-02-24 14:07:55 +00:00
parent 89a66f111b
commit 37d0bfa875

View File

@ -794,30 +794,14 @@ Rect* UMAGetControlBoundsInWindowCoords(ControlRef theControl, Rect *bounds)
GetControlBounds( theControl , bounds ) ;
#if TARGET_API_MAC_OSX
if ( win != NULL && win->MacGetTopLevelWindow() != NULL )
{
wxWindow* parent = win->GetParent() ;
if ( parent )
{
// the parent controls 'origin' expressed in its own
// window coordinates (explanation in window.cpp)
int x , y ;
x = 0 ;
y = 0 ;
WindowRef tlwref = GetControlOwner( theControl ) ;
wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ;
ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ;
if ( !parent->IsTopLevel() )
{
x += parent->MacGetLeftBorderSize() ;
y += parent->MacGetTopBorderSize() ;
}
HIPoint hiPoint = CGPointMake( 0 , 0 ) ;
parent->MacWindowToRootWindow( &x , & y ) ;
bounds->left += x ;
bounds->right += x ;
bounds->top += y ;
bounds->bottom += y ;
}
}
HIViewConvertPoint( &hiPoint , HIViewGetSuperview(theControl) , rootControl ) ;
OffsetRect( bounds , hiPoint.x , hiPoint.y ) ;
#endif
return bounds ;
}