+#if wxMAC_USE_CORE_GRAPHICS && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
+ if ( HIThemeDrawFrame != 0)
+ {
+ Rect srect = rect ;
+ HIThemeFrameDrawInfo info ;
+ memset( &info, 0 , sizeof( info ) ) ;
+
+ info.version = 0 ;
+ info.kind = 0 ;
+ info.state = IsEnabled() ? kThemeStateActive : kThemeStateInactive ;
+ info.isFocused = hasFocus ;
+ bool draw = false ;
+
+ CGContextRef cgContext = (CGContextRef) GetParent()->MacGetCGContextRef() ;
+ wxASSERT( cgContext ) ;
+
+ if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
+ {
+ SInt32 border = 0 ;
+ GetThemeMetric( kThemeMetricEditTextFrameOutset , &border ) ;
+ InsetRect( &srect , border , border );
+ info.kind = kHIThemeFrameTextFieldSquare ;
+ draw = true ;
+ }
+ else if (HasFlag(wxSIMPLE_BORDER))
+ {
+ SInt32 border = 0 ;
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+ InsetRect( &srect , border , border );
+ info.kind = kHIThemeFrameListBox ;
+ draw = true ;
+ }
+
+ if ( draw )
+ {
+ CGRect cgrect = CGRectMake( srect.left , srect.top , srect.right - srect.left ,
+ srect.bottom - srect.top ) ;
+ HIThemeDrawFrame( &cgrect , &info , cgContext , kHIThemeOrientationNormal ) ;
+ }
+ else if ( hasFocus )
+ {
+ srect = rect ;
+ CGRect cgrect = CGRectMake( srect.left , srect.top , srect.right - srect.left ,
+ srect.bottom - srect.top ) ;
+ HIThemeDrawFocusRect( &cgrect , true , cgContext , kHIThemeOrientationNormal ) ;
+ }
+
+ m_peer->GetRect( &rect ) ;
+ if ( hasBothScrollbars )
+ {
+ srect = rect ;
+ int size = m_hScrollBar->GetWindowVariant() == wxWINDOW_VARIANT_NORMAL ? 16 : 12 ;
+ CGRect cgrect = CGRectMake( srect.right - size , srect.bottom - size , size , size ) ;
+ CGPoint cgpoint = CGPointMake( srect.right - size , srect.bottom - size ) ;
+ HIThemeGrowBoxDrawInfo info ;
+ memset( &info, 0 , sizeof( info ) ) ;
+ info.version = 0 ;
+ info.state = IsEnabled() ? kThemeStateActive : kThemeStateInactive ;
+ info.kind = kHIThemeGrowBoxKindNone ;
+ info.size = kHIThemeGrowBoxSizeNormal ;
+ info.direction = kThemeGrowRight | kThemeGrowDown ;
+ HIThemeDrawGrowBox( &cgpoint , &info , cgContext , kHIThemeOrientationNormal ) ;
+ }
+ }
+ else
+#endif