Move wxRendererMSW::DrawTextCtrl() implementation to wxRendererGeneric.

This ensures that wxRendererGeneric::DrawGauge() is actually usable as
otherwise calling it always resulted in an assertion failure because it used
DrawTextCtrl() which was not implemented in wxRendererGeneric. So this fixes
using DrawGauge() in non-MSW ports which was added by r77023 (see #16406) but
apparently never worked.

Also remove wxRendererMSW::DrawGauge() as it's exactly the same as the version
inherited from wxRendererGeneric.

Closes #16725.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78278 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-12-16 20:16:20 +00:00
parent a580f0b994
commit 090a8353e5
2 changed files with 20 additions and 59 deletions

View File

@@ -777,10 +777,21 @@ void wxRendererGeneric::DrawRadioBitmap(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(
wxFAIL_MSG("UNIMPLEMENTED: wxRendererGeneric::DrawRadioBitmap");
}
void wxRendererGeneric::DrawTextCtrl(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc),
const wxRect& WXUNUSED(rect), int WXUNUSED(flags))
void wxRendererGeneric::DrawTextCtrl(wxWindow* WXUNUSED(win),
wxDC& dc,
const wxRect& rect,
int WXUNUSED(flags))
{
wxFAIL_MSG("UNIMPLEMENTED: wxRendererGeneric::DrawTextCtrl");
wxColour fill;
wxColour bdr;
{
fill = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
bdr = *wxBLACK;
}
dc.SetPen(bdr);
dc.SetBrush(fill);
dc.DrawRectangle(rect);
}
#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
@@ -800,7 +811,12 @@ void wxRendererGeneric::DrawTitleBarBitmap(wxWindow * WXUNUSED(win),
#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
void wxRendererGeneric::DrawGauge(wxWindow* win, wxDC& dc, const wxRect& rect, int value, int max, int WXUNUSED(flags))
void wxRendererGeneric::DrawGauge(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int value,
int max,
int WXUNUSED(flags))
{
// Use same background as text controls.
DrawTextCtrl(win, dc, rect);

View File

@@ -153,11 +153,6 @@ public:
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
virtual void DrawTextCtrl(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
};
// ----------------------------------------------------------------------------
@@ -189,11 +184,6 @@ public:
const wxRect& rect,
int flags = 0);
virtual void DrawTextCtrl(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0);
virtual void DrawRadioBitmap(wxWindow* win,
wxDC& dc,
const wxRect& rect,
@@ -208,13 +198,6 @@ public:
wxTitleBarButton button,
int flags = 0);
virtual void DrawGauge(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int value,
int max,
int flags = 0);
virtual wxSize GetCheckBoxSize(wxWindow *win);
virtual int GetHeaderButtonHeight(wxWindow *win);
@@ -597,44 +580,6 @@ int wxRendererMSW::GetHeaderButtonMargin(wxWindow *WXUNUSED(win))
return 10;
}
// Uses the theme to draw the border and fill for something like a wxTextCtrl
void wxRendererMSW::DrawTextCtrl(wxWindow* WXUNUSED(win),
wxDC& dc,
const wxRect& rect,
int WXUNUSED(flags))
{
wxColour fill;
wxColour bdr;
{
fill = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
bdr = *wxBLACK;
}
dc.SetPen(bdr);
dc.SetBrush(fill);
dc.DrawRectangle(rect);
}
void wxRendererMSW::DrawGauge(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int value,
int max,
int WXUNUSED(flags))
{
// Use text ctrl back as background
DrawTextCtrl(win, dc, rect);
// Calc progress bar size
wxRect progRect(rect);
progRect.Deflate(2);
progRect.width = wxMulDivInt32(progRect.width, value, max);
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(progRect);
}
// ============================================================================
// wxRendererXP implementation
// ============================================================================