Use native renderer for drawing check boxes in wxPG only if wxPG_USE_RENDERER_NATIVE flag is set.

wxPG_USE_RENDERER_NATIVE flag is used in wxPG code to control whether  native renderers can be called and we need to employ it. Legacy custom drawing code is used if this flag is no set.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Artur Wieczorek
2014-07-13 16:34:42 +00:00
parent 45adc64f9f
commit f1c25a7838

View File

@@ -1409,6 +1409,7 @@ const int wxSCB_SETVALUE_CYCLE = 2;
static void DrawSimpleCheckBox( wxWindow* win, wxDC& dc, const wxRect& rect, static void DrawSimpleCheckBox( wxWindow* win, wxDC& dc, const wxRect& rect,
int box_h, int state ) int box_h, int state )
{ {
#if wxPG_USE_RENDERER_NATIVE
// Box rectangle // Box rectangle
wxRect r(rect.x+wxPG_XBEFORETEXT, rect.y+((rect.height-box_h)/2), wxRect r(rect.x+wxPG_XBEFORETEXT, rect.y+((rect.height-box_h)/2),
box_h, box_h); box_h, box_h);
@@ -1429,6 +1430,59 @@ static void DrawSimpleCheckBox( wxWindow* win, wxDC& dc, const wxRect& rect,
} }
wxRendererNative::Get().DrawCheckBox(win, dc, r, cbFlags); wxRendererNative::Get().DrawCheckBox(win, dc, r, cbFlags);
#else
wxUnusedVar(win);
// Box rectangle
wxRect r(rect.x+wxPG_XBEFORETEXT, rect.y+((rect.height-box_h)/2),
box_h, box_h);
wxColour useCol = dc.GetTextForeground();
if ( state & wxSCB_STATE_UNSPECIFIED )
{
useCol = wxColour(220, 220, 220);
}
// Draw check mark first because it is likely to overdraw the
// surrounding rectangle.
if ( state & wxSCB_STATE_CHECKED )
{
wxRect r2(r.x+wxPG_CHECKMARK_XADJ,
r.y+wxPG_CHECKMARK_YADJ,
r.width+wxPG_CHECKMARK_WADJ,
r.height+wxPG_CHECKMARK_HADJ);
#if wxPG_CHECKMARK_DEFLATE
r2.Deflate(wxPG_CHECKMARK_DEFLATE);
#endif
dc.DrawCheckMark(r2);
// This would draw a simple cross check mark.
// dc.DrawLine(r.x,r.y,r.x+r.width-1,r.y+r.height-1);
// dc.DrawLine(r.x,r.y+r.height-1,r.x+r.width-1,r.y);
}
if ( !(state & wxSCB_STATE_BOLD) )
{
// Pen for thin rectangle.
dc.SetPen(useCol);
}
else
{
// Pen for bold rectangle.
wxPen linepen(useCol,2,wxPENSTYLE_SOLID);
linepen.SetJoin(wxJOIN_MITER); // This prevents round edges.
dc.SetPen(linepen);
r.x++;
r.y++;
r.width--;
r.height--;
}
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(r);
dc.SetPen(*wxTRANSPARENT_PEN);
#endif
} }
// //