#include "wx/control.h"
+#if wxUSE_NOTEBOOK
+ #include "wx/notebook.h"
+#endif // wxUSE_NOTEBOOK
+
#include "wx/msw/private.h"
+#include "wx/msw/uxtheme.h"
#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__))
#include <commctrl.h>
}
#endif // Win95
-WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
-#if wxUSE_CTL3D
- WXUINT message,
- WXWPARAM wParam,
- WXLPARAM lParam
-#else
- WXUINT WXUNUSED(message),
- WXWPARAM WXUNUSED(wParam),
- WXLPARAM WXUNUSED(lParam)
-#endif
- )
+WXHBRUSH wxControl::MSWControlColorSolid(WXHDC pDC, wxColour colBg)
{
-#if wxUSE_CTL3D
- if ( m_useCtl3D )
+ HDC hdc = (HDC)pDC;
+ if ( m_hasFgCol )
+ ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
+
+ if ( colBg.Ok() )
{
- HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
- return (WXHBRUSH) hbrush;
+ ::SetBkColor(hdc, wxColourToRGB(colBg));
+
+ wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg, wxSOLID);
+
+ return (WXHBRUSH)brush->GetResourceHandle();
}
-#endif // wxUSE_CTL3D
- HDC hdc = (HDC)pDC;
- wxColour colBack = GetBackgroundColour();
+ return 0;
+}
- ::SetBkColor(hdc, wxColourToRGB(colBack));
- ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
+WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
+{
+ WXHBRUSH hbr = MSWControlColorSolid(pDC, m_hasBgCol ? m_backgroundColour
+ : wxNullColour);
+ if ( hbr )
+ return hbr;
- wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
+ ::SetBkMode((HDC)pDC, TRANSPARENT);
- return (WXHBRUSH)brush->GetResourceHandle();
+#if wxUSE_UXTHEME && wxUSE_NOTEBOOK
+ if ( wxUxThemeEngine::GetIfActive() )
+ {
+ for ( wxWindow *win = this; win; win = win->GetParent() )
+ {
+ wxNotebook *nbook = wxDynamicCast(win, wxNotebook);
+ if ( nbook )
+ {
+ // return value may be NULL but it is ok: if the first parent
+ // notebook doesn't use themes, then we don't have to process
+ // this message at all, so let default processing take place
+ return nbook->GetThemeBackgroundBrush(pDC, this);
+ }
+ }
+ }
+#endif // wxUSE_UXTHEME
+
+ return ::GetStockObject(NULL_BRUSH);
+}
+
+WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC)
+{
+ return MSWControlColorSolid
+ (
+ pDC,
+ wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
+ );
}
// ---------------------------------------------------------------------------