- dc.SetPen( *wxWHITE_PEN );
- dc.DrawRectangle( x, y, w-CORNER+1, 1 ); // top (outer)
- dc.DrawRectangle( x, y, 1, h ); // left (outer)
- dc.DrawLine( x, y+h-1, x+1, y+h-1 );
- dc.DrawLine( x+w-1, y, x+w-1, y+1 );
+#if defined(__WXMAC_OSX__) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 )
+ if ( HIThemeDrawButton != 0 )
+ {
+ HIRect headerRect = CGRectMake( x , y , w , h );
+ if ( dc.IsKindOf( CLASSINFO( wxPaintDC ) ) == false )
+ {
+ Rect r = { (short) headerRect.origin.y , (short) headerRect.origin.x ,
+ (short) (headerRect.origin.y + headerRect.size.height) , (short) (headerRect.origin.x + headerRect.size.width) } ;
+ RgnHandle updateRgn = NewRgn() ;
+ RectRgn( updateRgn , &r ) ;
+ HIViewSetNeedsDisplayInRegion( (HIViewRef) win->GetHandle() , updateRgn , true ) ;
+ DisposeRgn( updateRgn ) ;
+ }
+ else
+ {
+ CGContextRef cgContext ;
+#if wxMAC_USE_CORE_GRAPHICS
+ cgContext = dynamic_cast<wxMacCGContext*>(dc.GetGraphicContext())->GetNativeContext() ;
+#else
+ Rect bounds ;
+ GetPortBounds( (CGrafPtr) dc.m_macPort , &bounds ) ;
+ QDBeginCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
+ CGContextTranslateCTM( cgContext , 0 , bounds.bottom - bounds.top ) ;
+ CGContextScaleCTM( cgContext , 1 , -1 ) ;
+ HIViewConvertRect( &headerRect , (HIViewRef) win->GetHandle() , (HIViewRef) win->MacGetTopLevelWindow()->GetHandle() ) ;
+#endif
+ {
+ HIThemeButtonDrawInfo drawInfo ;
+ HIRect labelRect ;
+ memset( &drawInfo , 0 , sizeof(drawInfo) ) ;
+ drawInfo.version = 0 ;
+ drawInfo.state = ( flags & wxCONTROL_DISABLED ) ? kThemeStateInactive : kThemeStateActive ;
+ drawInfo.kind = kThemeListHeaderButton ;
+ drawInfo.value = 0 ;
+ drawInfo.adornment = kThemeAdornmentNone ;
+ HIThemeDrawButton( &headerRect , &drawInfo , cgContext , kHIThemeOrientationNormal , &labelRect ) ;
+ }
+#if wxMAC_USE_CORE_GRAPHICS
+#else
+ QDEndCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
+#endif
+ }
+ }
+ else
+#endif
+ {
+ wxMacWindowClipper clipper(win) ;
+ Rect rect = { y , x , y + h , x + w } ;
+ wxPoint origin = win->GetClientAreaOrigin() ;
+ int dx , dy ;
+ dx = origin.x ;
+ dy = origin.y ;
+ win->MacWindowToRootWindow( &dx , &dy ) ;
+ OffsetRect( &rect , dx , dy ) ;
+
+ ThemeButtonDrawInfo drawInfo ;
+ memset( &drawInfo , 0 , sizeof(drawInfo) ) ;
+ drawInfo.state = ( flags & wxCONTROL_DISABLED ) ? kThemeStateInactive : kThemeStateActive ;
+ drawInfo.value = 0 ;
+ drawInfo.adornment = kThemeAdornmentNone ;
+ DrawThemeButton( &rect , kThemeListHeaderButton , &drawInfo , NULL , NULL , NULL , 0 ) ;
+ }