From c5c4c31e6cdaea9afcc10b04e6fe37ec02e300a4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 11 Dec 2004 23:34:15 +0000 Subject: [PATCH] added MSWAlwaysDrawBg() to account for controls such as sliders which must not draw background with transparent brush no matter what git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/control.h | 8 ++++++++ src/msw/control.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h index 574d84a74b..c3bd297ea4 100644 --- a/include/wx/msw/control.h +++ b/include/wx/msw/control.h @@ -133,6 +133,14 @@ protected: // common part of the 3 methods above WXHBRUSH MSWControlColorSolid(WXHDC pDC, wxColour colBg); + // another WM_CTLCOLOR-related function: if it returns false, we return + // NULL_BRUSH from MSWControlColor() to prevent the system from erasing the + // background at all + // + // override this function to return true for controls which do want to + // draw their background themselves + virtual bool MSWAlwaysDrawBg() const { return false; } + // this is a helper for the derived class GetClassDefaultAttributes() // implementation: it returns the right colours for the classes which // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 30bc08f498..96547014e9 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -371,7 +371,7 @@ WXHBRUSH wxControl::MSWControlColor(WXHDC pDC) } #endif // wxUSE_UXTHEME - return ::GetStockObject(NULL_BRUSH); + return MSWAlwaysDrawBg() ? 0 : ::GetStockObject(NULL_BRUSH); } WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC) -- 2.45.2