+ wxRendererNative& renderer = wxRendererNative::Get();
+
+ int x1 = 10, // text offset
+ x2 = 300, // drawing offset
+ y = 10;
+
+ const int lineHeight = dc.GetCharHeight();
+ dc.DrawText("Demonstration of various wxRenderer functions:", x1, y);
+ y += lineHeight;
+ wxString flagsString;
+ if ( m_flags & wxCONTROL_DISABLED )
+ flagsString += "wxCONTROL_DISABLED ";
+ if ( m_flags & wxCONTROL_FOCUSED )
+ flagsString += "wxCONTROL_FOCUSED ";
+ if ( m_flags & wxCONTROL_PRESSED )
+ flagsString += "wxCONTROL_PRESSED ";
+ if ( m_flags & wxCONTROL_CURRENT )
+ flagsString += "wxCONTROL_CURRENT ";
+ if ( m_flags & wxCONTROL_CHECKED )
+ flagsString += "wxCONTROL_CHECKED ";
+ if ( m_flags & wxCONTROL_UNDETERMINED )
+ flagsString += "wxCONTROL_UNDETERMINED ";
+ if ( flagsString.empty() )
+ flagsString = "(none)";
+ dc.DrawText("Using flags: " + flagsString, x1, y);
+ y += lineHeight*3;
+
+ const wxCoord heightHdr = renderer.GetHeaderButtonHeight(this);
+ const wxCoord widthHdr = 120;
+
+ const wxHeaderSortIconType
+ hdrSortIcon = m_useIcon ? wxHDR_SORT_ICON_UP
+ : wxHDR_SORT_ICON_NONE;
+
+ wxHeaderButtonParams hdrParams;
+ hdrParams.m_labelText = "Header";
+ hdrParams.m_labelAlignment = m_align;
+ if ( m_useBitmap )
+ {
+ hdrParams.m_labelBitmap = wxArtProvider::GetBitmap(wxART_WARNING,
+ wxART_LIST);
+ }
+
+ dc.DrawText("DrawHeaderButton() (default)", x1, y);
+ wxRendererNative::GetDefault().DrawHeaderButton(this, dc,
+ wxRect(x2, y, widthHdr, heightHdr), m_flags,
+ hdrSortIcon, &hdrParams);
+ y += lineHeight + heightHdr;
+
+ dc.DrawText("DrawHeaderButton() (overridden)", x1, y);
+ renderer.DrawHeaderButton(this, dc,
+ wxRect(x2, y, widthHdr, heightHdr), m_flags,
+ hdrSortIcon, &hdrParams);
+ y += lineHeight + heightHdr;
+
+ dc.DrawText("DrawCheckBox()", x1, y);
+ const wxSize sizeCheck = renderer.GetCheckBoxSize(this);
+ renderer.DrawCheckBox(this, dc,
+ wxRect(wxPoint(x2, y), sizeCheck), m_flags);
+ y += lineHeight + sizeCheck.y;
+
+ dc.DrawText("DrawRadioBitmap()", x1, y);
+ renderer.DrawRadioBitmap(this, dc,
+ wxRect(wxPoint(x2, y), sizeCheck), m_flags);
+ y += lineHeight + sizeCheck.y;
+
+ dc.DrawText("DrawTreeItemButton()", x1, y);
+ renderer.DrawTreeItemButton(this, dc,
+ wxRect(x2, y, 20, 20), m_flags);
+ y += lineHeight + 20;
+
+#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
+ dc.DrawText("DrawTitleBarBitmap()", x1, y);
+ wxRect rBtn(x2, y, 21, 21);
+ renderer.DrawTitleBarBitmap(this, dc, rBtn,
+ wxTITLEBAR_BUTTON_HELP, m_flags);
+ rBtn.x += 2*rBtn.width;
+ renderer.DrawTitleBarBitmap(this, dc, rBtn,
+ wxTITLEBAR_BUTTON_ICONIZE, m_flags);
+ rBtn.x += 2*rBtn.width;
+ renderer.DrawTitleBarBitmap(this, dc, rBtn,
+ wxTITLEBAR_BUTTON_RESTORE, m_flags);
+ rBtn.x += 2*rBtn.width;
+ renderer.DrawTitleBarBitmap(this, dc, rBtn,
+ wxTITLEBAR_BUTTON_MAXIMIZE, m_flags);
+ rBtn.x += 2*rBtn.width;
+ renderer.DrawTitleBarBitmap(this, dc, rBtn,
+ wxTITLEBAR_BUTTON_CLOSE, m_flags);
+
+ y += lineHeight + rBtn.height;
+#endif // wxHAS_DRAW_TITLE_BAR_BITMAP