]> git.saurik.com Git - wxWidgets.git/commitdiff
Correct custom renderer method override example in the sample.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 5 Oct 2009 22:56:31 +0000 (22:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 5 Oct 2009 22:56:31 +0000 (22:56 +0000)
The implementation of DrawHeaderButton() in MyRenderer should restore the
text foreground colour and brush to avoid messing up drawing done after it.

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

samples/render/render.cpp

index 0233d24bce4df3ecb1f3a8a93e3f2a197baec6c6..89461121d621222a59c9628ad7ac390a0be8a411 100644 (file)
@@ -66,8 +66,8 @@ public:
                                   wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE,
                                   wxHeaderButtonParams* WXUNUSED(params) = NULL)
     {
-        dc.SetBrush(*wxBLUE_BRUSH);
-        dc.SetTextForeground(*wxWHITE);
+        wxDCBrushChanger setBrush(dc, *wxBLUE_BRUSH);
+        wxDCTextColourChanger setFgCol(dc, *wxWHITE);
         dc.DrawRoundedRectangle(rect, 5);
         dc.DrawLabel(wxT("MyRenderer"), wxNullBitmap, rect, wxALIGN_CENTER);
         return rect.width;