Display graphics renderer info in the drawing sample.

Display on the status bar a description (name and version) of currently used graphics renderer.
This commit is contained in:
Artur Wieczorek 2016-03-16 21:43:08 +01:00
parent 3bf30d14fd
commit 494c2e3a6a

View File

@ -111,8 +111,7 @@ public:
void Clip(bool clip) { m_clip = clip; Refresh(); }
#if wxUSE_GRAPHICS_CONTEXT
bool HasRenderer() const { return m_renderer != NULL; }
void UseGraphicRenderer(wxGraphicsRenderer* renderer)
{ m_renderer = renderer; Refresh(); }
void UseGraphicRenderer(wxGraphicsRenderer* renderer);
bool IsDefaultRenderer() const
{ if ( !m_renderer ) return false;
return m_renderer == wxGraphicsRenderer::GetDefaultRenderer();
@ -1908,6 +1907,27 @@ void MyCanvas::OnMouseUp(wxMouseEvent &event)
}
}
#if wxUSE_GRAPHICS_CONTEXT
void MyCanvas::UseGraphicRenderer(wxGraphicsRenderer* renderer)
{
m_renderer = renderer;
if (renderer)
{
int major, minor, micro;
renderer->GetVersion(&major, &minor, &micro);
wxString str = wxString::Format("Graphic renderer: %s %i.%i.%i",
renderer->GetName().c_str(), major, minor, micro);
m_owner->SetStatusText(str, 1);
}
else
{
m_owner->SetStatusText(wxEmptyString, 1);
}
Refresh();
}
#endif // wxUSE_GRAPHICS_CONTEXT
// ----------------------------------------------------------------------------
// MyFrame
// ----------------------------------------------------------------------------