Add demonstration of a few more wxRenderer methods.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 5 Oct 2009 22:56:36 +0000 (22:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 5 Oct 2009 22:56:36 +0000 (22:56 +0000)
Also show the effect of calling several more DrawXXX() methods in the sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/render/render.cpp

index 89461121d621222a59c9628ad7ac390a0be8a411..6ebf987ae4a6fdcbe23f873ca898116dca8f3cf6 100644 (file)
@@ -130,13 +130,33 @@ public:
     {
         wxPaintDC dc(this);
 
-        dc.DrawText(wxT("Below is the standard header button drawn"), 10, 10);
-        dc.DrawText(wxT("using the current renderer:"), 10, 40);
-
         wxRendererNative& renderer = wxRendererNative::Get();
-        const wxCoord height = renderer.GetHeaderButtonHeight(this);
 
-        renderer.DrawHeaderButton(this, dc, wxRect(20, 70, 100, height));
+        int x1 = 10,    // text offset
+            x2 = 200,   // drawing offset
+            y = 10;
+
+        const int lineHeight = dc.GetCharHeight();
+        dc.DrawText("Demonstration of various wxRenderer functions:", x1, y);
+        y += lineHeight*3;
+
+        dc.DrawText("DrawHeaderButton() (overridden)", x1, y);
+        const wxCoord heightHdr = renderer.GetHeaderButtonHeight(this);
+        renderer.DrawHeaderButton(this, dc, wxRect(x2, y, 100, heightHdr));
+        y += lineHeight + heightHdr;
+
+        dc.DrawText("DrawCheckBox()", x1, y);
+        const wxSize sizeCheck = renderer.GetCheckBoxSize(this);
+        renderer.DrawCheckBox(this, dc, wxRect(wxPoint(x2, y), sizeCheck));
+        y += lineHeight + sizeCheck.y;
+
+        dc.DrawText("DrawRadioBitmap()", x1, y);
+        renderer.DrawRadioBitmap(this, dc, wxRect(wxPoint(x2, y), sizeCheck));
+        y += lineHeight + sizeCheck.y;
+
+        dc.DrawText("DrawTreeItemButton()", x1, y);
+        renderer.DrawTreeItemButton(this, dc, wxRect(x2, y, 20, 20));
+        y += lineHeight + 20;
     }
 
     DECLARE_EVENT_TABLE()