From 8263e4b366a432af1485e62bd91495b75d30c7a6 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Fri, 12 Feb 2021 21:44:32 +0100 Subject: [PATCH] Avoid assert failures in render sample with generic renderer Some generic render functions aren't implemented and result in obtrusive assert failures when switching to use the generic renderer in the render sample. Instead show text saying the drawing function is not implemented in the location where the sample would ordinarily draw the control. --- samples/render/render.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/samples/render/render.cpp b/samples/render/render.cpp index f6589271f6..2c6b8bedab 100644 --- a/samples/render/render.cpp +++ b/samples/render/render.cpp @@ -288,9 +288,15 @@ private: wxRect(wxPoint(x2, y), sizeMark), m_flags); y += lineHeight + sizeMark.y; + const wxString notImplementedText = "(generic version unimplemented)"; + dc.DrawText("DrawRadioBitmap()", x1, y); - renderer.DrawRadioBitmap(this, dc, - wxRect(wxPoint(x2, y), sizeCheck), m_flags); + if ( m_useGeneric ) + dc.DrawText(notImplementedText, x2, y); + else + renderer.DrawRadioBitmap(this, dc, + wxRect(wxPoint(x2, y), sizeCheck), m_flags); + y += lineHeight + sizeCheck.y; dc.DrawText("DrawCollapseButton()", x1, y); @@ -354,8 +360,11 @@ private: y += lineHeight; dc.DrawText("DrawChoice()", x1, y); - renderer.DrawChoice(this, dc, - wxRect(x2, y, width, 1.5*GetCharHeight()), m_flags); + if ( m_useGeneric ) + dc.DrawText(notImplementedText, x2, y); + else + renderer.DrawChoice(this, dc, + wxRect(x2, y, width, 1.5*GetCharHeight()), m_flags); } int m_flags;