+// Windows only: attempts to get colour for UX theme page background
+wxColour wxNotebook::GetThemeBackgroundColour()
+{
+#if wxUSE_UXTHEME
+ if (wxUxThemeEngine::Get())
+ {
+ WXHTHEME hTheme = wxUxThemeEngine::Get()->m_pfnOpenThemeData(GetHWND(), L"TAB");
+ if (hTheme)
+ {
+ // This is total guesswork.
+ // See PlatformSDK\Include\Tmschema.h for values
+ COLORREF themeColor;
+ wxUxThemeEngine::Get()->
+ m_pfnGetThemeColor(hTheme,
+ 10 /* TABP_BODY */,
+ 1 /* NORMAL */,
+ 3821, /* FILLCOLORHINT */
+ & themeColor);
+
+ wxUxThemeEngine::Get()->m_pfnCloseThemeData(hTheme);
+
+ wxColour colour(GetRValue(themeColor), GetGValue(themeColor), GetBValue(themeColor));
+ return colour;
+ }
+ }
+#endif
+ return GetBackgroundColour();
+}
+
+// Windows only: attempts to apply the UX theme page background to this page
+void wxNotebook::ApplyThemeBackground(wxWindow* window, const wxColour& colour)
+{
+#if wxUSE_UXTHEME
+ // Don't set the background for buttons since this will
+ // switch it into ownerdraw mode
+ if (window->IsKindOf(CLASSINFO(wxButton)) && !window->IsKindOf(CLASSINFO(wxBitmapButton)))
+ // This is essential, otherwise you'll see dark grey
+ // corners in the buttons.
+ ((wxButton*)window)->wxControl::SetBackgroundColour(colour);
+ else if (window->IsKindOf(CLASSINFO(wxStaticText)) ||
+ window->IsKindOf(CLASSINFO(wxStaticBox)) ||
+ window->IsKindOf(CLASSINFO(wxStaticLine)) ||
+ window->IsKindOf(CLASSINFO(wxRadioButton)) ||
+ window->IsKindOf(CLASSINFO(wxRadioBox)) ||
+ window->IsKindOf(CLASSINFO(wxCheckBox)) ||
+ window->IsKindOf(CLASSINFO(wxBitmapButton)) ||
+ window->IsKindOf(CLASSINFO(wxSlider)) ||
+ window->IsKindOf(CLASSINFO(wxPanel)) ||
+ (window->IsKindOf(CLASSINFO(wxNotebook)) && (window != this)) ||
+ window->IsKindOf(CLASSINFO(wxScrolledWindow))
+ )
+ {
+ window->SetBackgroundColour(colour);
+ }
+
+ for ( wxWindowList::compatibility_iterator node = window->GetChildren().GetFirst(); node; node = node->GetNext() )
+ {
+ wxWindow *child = node->GetData();
+ ApplyThemeBackground(child, colour);
+ }
+#endif
+}
+