From f215225dcf0042c7aaa4f970dd9cd4cabf2ecea5 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 9 Feb 2009 09:41:40 +0000 Subject: [PATCH] replacing RgnHandle with HIShapeRef usage git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/databrow.cpp | 13 +++++++++---- src/osx/carbon/window.cpp | 23 +++++++++++------------ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/osx/carbon/databrow.cpp b/src/osx/carbon/databrow.cpp index d84ee4ba2c..0c30b68a0f 100644 --- a/src/osx/carbon/databrow.cpp +++ b/src/osx/carbon/databrow.cpp @@ -1059,14 +1059,19 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowse // try to determine the content's size (drawable part): Rect content; - RgnHandle rgn(NewRgn()); + HIShapeRef rgn = NULL; + UInt16 headerHeight; - if (this->GetRegion(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 GetControlBounds(m_controlRef, &content); - ::DisposeRgn(rgn); // space for the header this->GetHeaderButtonHeight(&headerHeight); content.top += headerHeight; diff --git a/src/osx/carbon/window.cpp b/src/osx/carbon/window.cpp index 2e9a26ff25..87c1eb5d89 100644 --- a/src/osx/carbon/window.cpp +++ b/src/osx/carbon/window.cpp @@ -917,19 +917,24 @@ void wxMacControl::Lower() void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const { - RgnHandle rgn = NewRgn() ; - Rect content ; - if ( GetControlRegion( m_controlRef, kControlContentMetaPart , rgn ) == noErr ) - GetRegionBounds( rgn , &content ) ; + HIShapeRef rgn = NULL; + Rect 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 { - GetControlBounds( m_controlRef , &content ); + GetControlBounds(m_controlRef, &content); content.right -= content.left; content.left = 0; content.bottom -= content.top; content.top = 0; } - DisposeRgn( rgn ) ; left = content.left; top = content.top; @@ -1389,12 +1394,6 @@ void wxMacControl::GetFeatures( UInt32 * features ) GetControlFeatures( m_controlRef , features ); } -OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region ) -{ - OSStatus err = GetControlRegion( m_controlRef , partCode , region ); - return err; -} - void wxMacControl::PulseGauge() { }