From 71a21c065dc1d46b8ddd454b31e83f197dd6af0b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Sep 2014 17:40:53 +0000 Subject: [PATCH] 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 --- src/univ/themes/gtk.cpp | 44 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index 1288360c38..fcb09d4260 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -998,48 +998,46 @@ void wxGTKRenderer::DrawRadioButtonBitmap(wxDC& dc, const wxRect& rect, int flags) { - wxCoord x = rect.x, - y = rect.y, + wxCoord y = rect.y, xRight = rect.GetRight(), yBottom = rect.GetBottom(); wxCoord yMid = (y + yBottom) / 2; + DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT), rect); - // then draw the upper half - dc.SetPen(flags & wxCONTROL_CHECKED ? m_penDarkGrey : m_penHighlight); - DrawUpZag(dc, x, xRight, yMid, y); - DrawUpZag(dc, x + 1, xRight - 1, yMid, y + 1); + dc.SetPen(m_penDarkGrey); + dc.SetBrush(wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT)); + // draw the normal border + 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; - if ( flags & wxCONTROL_CHECKED ) - dc.SetPen(m_penBlack); - else if ( flags & wxCONTROL_PRESSED ) - dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED))); + + if ( flags & wxCONTROL_PRESSED ) + dc.SetBrush(wxColor(128, 138, 135)); else // unchecked and unpressed drawIt = false; if ( drawIt ) - DrawUpZag(dc, x + 2, xRight - 2, yMid, y + 2); + dc.DrawCircle(xRight/2,yBottom/2,yMid/2); - // and then the lower one - 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 ) + if ( flags & wxCONTROL_PRESSED ) { - dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED))); + dc.SetBrush(wxColor(128, 138, 135)); drawIt = true; } else // checked and unpressed drawIt = false; if ( drawIt ) - DrawDownZag(dc, x + 2, xRight - 2, yMid, yBottom - 2); + dc.DrawCircle(xRight/2,yBottom/2,yMid/2); } void wxGTKRenderer::DrawUpZag(wxDC& dc,