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,
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,