X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7822ffb1de54dbb0b89e03c3bae89a5ee91c7169..8e7a3ecb9c1b9f5653e56301f51dfa39acca6bc6:/src/generic/renderg.cpp diff --git a/src/generic/renderg.cpp b/src/generic/renderg.cpp index 0024bcec60..4d411dd12d 100644 --- a/src/generic/renderg.cpp +++ b/src/generic/renderg.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 20.07.2003 -// RCS-ID: $Id$ // Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -281,7 +280,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, // native hot-tracking line (on XP) const int penwidth = 3; int y = rect.y + rect.height + 1 - penwidth; - wxColour c = (params && params->m_selectionColour.Ok()) ? + wxColour c = (params && params->m_selectionColour.IsOk()) ? params->m_selectionColour : wxColour(0x66, 0x66, 0x66); wxPen pen(c, penwidth); pen.SetCap(wxCAP_BUTT); @@ -322,7 +321,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, triPt[2].y = ar.height; } - wxColour c = (params && params->m_arrowColour.Ok()) ? + wxColour c = (params && params->m_arrowColour.IsOk()) ? params->m_arrowColour : wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW); wxDCPenChanger setPen(dc, c); @@ -336,7 +335,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, int bmpWidth = 0; // draw the bitmap if there is one - if ( params && params->m_labelBitmap.Ok() ) + if ( params && params->m_labelBitmap.IsOk() ) { int w = params->m_labelBitmap.GetWidth(); int h = params->m_labelBitmap.GetHeight(); @@ -379,9 +378,9 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, const int margin = 5; // number of pixels to reserve on either side of the label labelWidth += 2*margin; - wxFont font = params->m_labelFont.Ok() ? + wxFont font = params->m_labelFont.IsOk() ? params->m_labelFont : win->GetFont(); - wxColour clr = params->m_labelColour.Ok() ? + wxColour clr = params->m_labelColour.IsOk() ? params->m_labelColour : win->GetForegroundColour(); wxString label( params->m_labelText ); @@ -468,12 +467,20 @@ wxRendererGeneric::DrawTreeItemButton(wxWindow * WXUNUSED(win), dc.DrawRectangle(rect); + // Make sure that the sign is properly centered by always using an + // odd-sized rectangle for it. + wxRect signRect(rect); + if ( !(signRect.x % 2) ) + signRect.x--; + if ( !(signRect.y % 2) ) + signRect.y--; + // black lines - const wxCoord xMiddle = rect.x + rect.width/2; - const wxCoord yMiddle = rect.y + rect.height/2; + const wxCoord xMiddle = signRect.x + signRect.width/2; + const wxCoord yMiddle = signRect.y + signRect.height/2; // half of the length of the horz lines in "-" and "+" - const wxCoord halfWidth = rect.width/2 - 2; + const wxCoord halfWidth = signRect.width/2 - 2; dc.SetPen(*wxBLACK_PEN); dc.DrawLine(xMiddle - halfWidth, yMiddle, xMiddle + halfWidth + 1, yMiddle); @@ -481,7 +488,7 @@ wxRendererGeneric::DrawTreeItemButton(wxWindow * WXUNUSED(win), if ( !(flags & wxCONTROL_EXPANDED) ) { // turn "-" into "+" - const wxCoord halfHeight = rect.height/2 - 2; + const wxCoord halfHeight = signRect.height/2 - 2; dc.DrawLine(xMiddle, yMiddle - halfHeight, xMiddle, yMiddle + halfHeight + 1); }