wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL );
virtual int GetHeaderButtonHeight(wxWindow *win);
wxDC& dc,
const wxRect& rect,
int flags,
+ wxHeaderSortIconType sortArrow,
wxHeaderButtonParams* params )
{
- const wxCoord x = dc.XLOG2DEV(rect.x /*- 1*/);
- const wxCoord y = dc.YLOG2DEV(rect.y /*- 1*/);
- const wxCoord w = dc.XLOG2DEVREL(rect.width);
- const wxCoord h = dc.YLOG2DEVREL(rect.height);
+ const wxCoord x = dc.LogicalToDeviceX(rect.x /*- 1*/);
+ const wxCoord y = dc.LogicalToDeviceY(rect.y /*- 1*/);
+ const wxCoord w = dc.LogicalToDeviceXRel(rect.width);
+ const wxCoord h = dc.LogicalToDeviceYRel(rect.height);
dc.SetBrush( *wxTRANSPARENT_BRUSH );
CGContextRef cgContext;
#if wxMAC_USE_CORE_GRAPHICS
- cgContext = ((wxMacCGContext*)(dc.GetGraphicContext()))->GetNativeContext();
+ cgContext = (CGContextRef) dc.GetGraphicContext()->GetNativeContext();
#else
Rect bounds;
drawInfo.adornment = kThemeAdornmentNone;
// The down arrow is drawn automatically, change it to an up arrow if needed.
- if ( flags & wxCONTROL_UPICON )
+ if ( sortArrow == wxHDR_SORT_ICON_UP )
drawInfo.adornment = kThemeAdornmentHeaderButtonSortUp;
HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
// If we don't want any arrows we need to draw over the one already there
- if ( (flags & wxCONTROL_SELECTED) && !(flags & (wxCONTROL_UPICON|wxCONTROL_DOWNICON)) )
+ if ( (flags & wxCONTROL_SELECTED) && (sortArrow == wxHDR_SORT_ICON_NONE) )
{
// clip to the header rectangle
CGContextSaveGState( cgContext );
// Reserve room for the arrows before writing the label, and turn off the
// flags we've already handled
wxRect newRect(rect);
- if ( (flags & wxCONTROL_SELECTED) && (flags & (wxCONTROL_UPICON|wxCONTROL_DOWNICON)) )
+ if ( (flags & wxCONTROL_SELECTED) && (sortArrow != wxHDR_SORT_ICON_NONE) )
{
newRect.width -= 12;
+ sortArrow = wxHDR_SORT_ICON_NONE;
}
- flags &= ~(wxCONTROL_SELECTED | wxCONTROL_UPICON | wxCONTROL_DOWNICON);
+ flags &= ~wxCONTROL_SELECTED;
- DrawHeaderButtonContents(win, dc, newRect, flags, params);
+ DrawHeaderButtonContents(win, dc, newRect, flags, sortArrow, params);
}
CGContextRef cgContext;
#if wxMAC_USE_CORE_GRAPHICS
- cgContext = ((wxMacCGContext*)(dc.GetGraphicContext()))->GetNativeContext();
+ cgContext = (CGContextRef) dc.GetGraphicContext()->GetNativeContext();
#else
Rect bounds;
GetPortBounds( (CGrafPtr) dc.m_macPort, &bounds );