rewrite the radio button draw function under gtk theme

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-09-23 17:40:53 +00:00
parent 66ed21d69b
commit 71a21c065d

View File

@@ -998,48 +998,46 @@ void wxGTKRenderer::DrawRadioButtonBitmap(wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags) int flags)
{ {
wxCoord x = rect.x, wxCoord y = rect.y,
y = rect.y,
xRight = rect.GetRight(), xRight = rect.GetRight(),
yBottom = rect.GetBottom(); yBottom = rect.GetBottom();
wxCoord yMid = (y + yBottom) / 2; wxCoord yMid = (y + yBottom) / 2;
DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT), rect);
// then draw the upper half dc.SetPen(m_penDarkGrey);
dc.SetPen(flags & wxCONTROL_CHECKED ? m_penDarkGrey : m_penHighlight); dc.SetBrush(wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT));
DrawUpZag(dc, x, xRight, yMid, y); // draw the normal border
DrawUpZag(dc, x + 1, xRight - 1, yMid, y + 1); dc.DrawCircle(xRight/2,yBottom/2,yMid);
wxColor col1, col2;
col1 = wxSCHEME_COLOUR(m_scheme, SHADOW_DARK);
col2 = wxSCHEME_COLOUR(m_scheme, SHADOW_IN);
dc.SetBrush(flags & wxCONTROL_CHECKED ? col1 : col2);
// inner dot
dc.DrawCircle(xRight/2,yBottom/2,yMid/2);
bool drawIt = true; bool drawIt = true;
if ( flags & wxCONTROL_CHECKED )
dc.SetPen(m_penBlack); if ( flags & wxCONTROL_PRESSED )
else if ( flags & wxCONTROL_PRESSED ) dc.SetBrush(wxColor(128, 138, 135));
dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED)));
else // unchecked and unpressed else // unchecked and unpressed
drawIt = false; drawIt = false;
if ( drawIt ) if ( drawIt )
DrawUpZag(dc, x + 2, xRight - 2, yMid, y + 2); dc.DrawCircle(xRight/2,yBottom/2,yMid/2);
// and then the lower one if ( flags & wxCONTROL_PRESSED )
dc.SetPen(flags & wxCONTROL_CHECKED ? m_penHighlight : m_penBlack);
DrawDownZag(dc, x, xRight, yMid, yBottom);
if ( !(flags & wxCONTROL_CHECKED) )
dc.SetPen(m_penDarkGrey);
DrawDownZag(dc, x + 1, xRight - 1, yMid, yBottom - 1);
if ( !(flags & wxCONTROL_CHECKED) )
drawIt = true; // with the same pen
else if ( flags & wxCONTROL_PRESSED )
{ {
dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED))); dc.SetBrush(wxColor(128, 138, 135));
drawIt = true; drawIt = true;
} }
else // checked and unpressed else // checked and unpressed
drawIt = false; drawIt = false;
if ( drawIt ) if ( drawIt )
DrawDownZag(dc, x + 2, xRight - 2, yMid, yBottom - 2); dc.DrawCircle(xRight/2,yBottom/2,yMid/2);
} }
void wxGTKRenderer::DrawUpZag(wxDC& dc, void wxGTKRenderer::DrawUpZag(wxDC& dc,