Demonstrate wxRenderer::DrawItemText() alignment in render sample
This is intended for wxMSW to show differences between themed text drawing (with wxRendererXP::DrawItemText() under Vista+) and wxRendererGeneric::DrawItemText(). Use existing option to switch between generic and native renderer (Ctrl-G) in the render sample to observe the differences.
This commit is contained in:
@@ -246,6 +246,26 @@ private:
|
|||||||
dc.DrawText("Using flags: " + flagsString, x1, y);
|
dc.DrawText("Using flags: " + flagsString, x1, y);
|
||||||
y += lineHeight*3;
|
y += lineHeight*3;
|
||||||
|
|
||||||
|
const wxCoord heightListItem = FromDIP(48);
|
||||||
|
const wxCoord widthListItem = 30*GetCharWidth();
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
dc.DrawText("DrawItemText() alignment", x1, y);
|
||||||
|
|
||||||
|
wxRect textRect(x2, y, widthListItem, heightListItem);
|
||||||
|
wxDCBrushChanger setBrush(dc, *wxTRANSPARENT_BRUSH);
|
||||||
|
wxDCPenChanger setPen(dc, *wxGREEN_PEN);
|
||||||
|
dc.DrawRectangle(textRect);
|
||||||
|
|
||||||
|
renderer.DrawItemText(this, dc, L"Top Left (\u1ED6)", textRect);
|
||||||
|
renderer.DrawItemText(this, dc, "Bottom right", textRect,
|
||||||
|
wxALIGN_BOTTOM | wxALIGN_RIGHT);
|
||||||
|
|
||||||
|
y += lineHeight + heightListItem;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const wxCoord heightHdr = renderer.GetHeaderButtonHeight(this);
|
const wxCoord heightHdr = renderer.GetHeaderButtonHeight(this);
|
||||||
const wxCoord width = 15*GetCharWidth();
|
const wxCoord width = 15*GetCharWidth();
|
||||||
|
|
||||||
@@ -346,9 +366,6 @@ private:
|
|||||||
|
|
||||||
y += lineHeight + heightGauge;
|
y += lineHeight + heightGauge;
|
||||||
|
|
||||||
const wxCoord heightListItem = FromDIP(48);
|
|
||||||
const wxCoord widthListItem = 30*GetCharWidth();
|
|
||||||
|
|
||||||
dc.DrawText("DrawItemSelectionRect()", x1, y);
|
dc.DrawText("DrawItemSelectionRect()", x1, y);
|
||||||
renderer.DrawItemSelectionRect(this, dc,
|
renderer.DrawItemSelectionRect(this, dc,
|
||||||
wxRect(x2, y, widthListItem, heightListItem), m_flags | wxCONTROL_SELECTED);
|
wxRect(x2, y, widthListItem, heightListItem), m_flags | wxCONTROL_SELECTED);
|
||||||
|
Reference in New Issue
Block a user