Add wxRendererNative::DrawGauge() method.

Add the method with the native implementations for MSW and OS X and a generic
version fallback.

Closes #16406.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77023 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-08-08 01:03:31 +00:00
parent 7e6515e1ad
commit 86cf756ba9
8 changed files with 187 additions and 14 deletions

View File

@@ -130,6 +130,8 @@ public:
int flags = 0) wxOVERRIDE;
#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
virtual void DrawGauge(wxWindow* win, wxDC& dc, const wxRect& rect, int value, int max, int flags = 0) wxOVERRIDE;
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) wxOVERRIDE;
virtual wxRendererVersion GetVersion() const wxOVERRIDE
@@ -792,6 +794,20 @@ 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))
{
// Use same background as text controls.
DrawTextCtrl(win, dc, rect);
// Calculate the progress bar size.
wxRect progRect(rect);
progRect.Deflate(2);
progRect.SetWidth(progRect.GetWidth() * ((double)value / max));
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(progRect);
}
// ----------------------------------------------------------------------------
// A module to allow cleanup of generic renderer.