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.
This commit is contained in:
Dimitri Schoolwerth
2021-02-12 21:44:32 +01:00
parent d04dfd6f22
commit 8263e4b366

View File

@@ -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;