replacing RgnHandle with HIShapeRef usage

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-02-09 09:41:40 +00:00
parent 5398a2e050
commit f215225dcf
2 changed files with 20 additions and 16 deletions

View File

@@ -1059,14 +1059,19 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowse
// try to determine the content's size (drawable part): // try to determine the content's size (drawable part):
Rect content; Rect content;
RgnHandle rgn(NewRgn()); HIShapeRef rgn = NULL;
UInt16 headerHeight; UInt16 headerHeight;
if (this->GetRegion(kControlContentMetaPart,rgn) == noErr) if ( HIViewCopyShape(m_controlRef, kHIViewContentMetaPart, &rgn) == noErr)
GetRegionBounds(rgn,&content); {
CGRect cgrect;
HIShapeGetBounds(rgn, &cgrect);
content = (Rect){ cgrect.origin.y, cgrect.origin.x, cgrect.origin.y+cgrect.size.height, cgrect.origin.x+cgrect.size.width };
CFRelease(rgn);
}
else else
GetControlBounds(m_controlRef, &content); GetControlBounds(m_controlRef, &content);
::DisposeRgn(rgn);
// space for the header // space for the header
this->GetHeaderButtonHeight(&headerHeight); this->GetHeaderButtonHeight(&headerHeight);
content.top += headerHeight; content.top += headerHeight;

View File

@@ -917,19 +917,24 @@ void wxMacControl::Lower()
void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const
{ {
RgnHandle rgn = NewRgn() ; HIShapeRef rgn = NULL;
Rect content ; Rect content ;
if ( GetControlRegion( m_controlRef, kControlContentMetaPart , rgn ) == noErr )
GetRegionBounds( rgn , &content ) ; if ( HIViewCopyShape(m_controlRef, kHIViewContentMetaPart, &rgn) == noErr)
{
CGRect cgrect;
HIShapeGetBounds(rgn, &cgrect);
content = (Rect){ cgrect.origin.y, cgrect.origin.x, cgrect.origin.y+cgrect.size.height, cgrect.origin.x+cgrect.size.width };
CFRelease(rgn);
}
else else
{ {
GetControlBounds( m_controlRef , &content ); GetControlBounds(m_controlRef, &content);
content.right -= content.left; content.right -= content.left;
content.left = 0; content.left = 0;
content.bottom -= content.top; content.bottom -= content.top;
content.top = 0; content.top = 0;
} }
DisposeRgn( rgn ) ;
left = content.left; left = content.left;
top = content.top; top = content.top;
@@ -1389,12 +1394,6 @@ void wxMacControl::GetFeatures( UInt32 * features )
GetControlFeatures( m_controlRef , features ); GetControlFeatures( m_controlRef , features );
} }
OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region )
{
OSStatus err = GetControlRegion( m_controlRef , partCode , region );
return err;
}
void wxMacControl::PulseGauge() void wxMacControl::PulseGauge()
{ {
} }