wxShowEffect effect,
unsigned timeout)
{
+ if ( effect == wxSHOW_EFFECT_NONE )
+ return Show(show);
+
if ( !wxWindowBase::Show(show) )
return false;
return s_cmap;
}
+#if wxUSE_UXTHEME && !defined(TMT_FILLCOLOR)
+ #define TMT_FILLCOLOR 3802
+ #define TMT_TEXTCOLOR 3803
+ #define TMT_BORDERCOLOR 3801
+#endif
+
+wxColour wxWindowMSW::MSWGetThemeColour(const wchar_t *themeName,
+ int themePart,
+ int themeState,
+ MSWThemeColour themeColour,
+ wxSystemColour fallback)
+{
+#if wxUSE_UXTHEME
+ const wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
+ if ( theme )
+ {
+ int themeProperty = 0;
+
+ // TODO: Convert this into a table? Sure would be faster.
+ switch ( themeColour )
+ {
+ case ThemeColourBackground:
+ themeProperty = TMT_FILLCOLOR;
+ break;
+ case ThemeColourText:
+ themeProperty = TMT_TEXTCOLOR;
+ break;
+ case ThemeColourBorder:
+ themeProperty = TMT_BORDERCOLOR;
+ break;
+ default:
+ wxFAIL_MSG(wxT("unsupported theme colour"));
+ };
+
+ wxUxThemeHandle hTheme(this, themeName);
+ COLORREF col;
+ HRESULT hr = theme->GetThemeColor
+ (
+ hTheme,
+ themePart,
+ themeState,
+ themeProperty,
+ &col
+ );
+
+ if ( SUCCEEDED(hr) )
+ return wxRGBToColour(col);
+
+ wxLogApiError(
+ wxString::Format(
+ "GetThemeColor(%s, %i, %i, %i)",
+ themeName, themePart, themeState, themeProperty),
+ hr);
+ }
+#else
+ wxUnusedVar(themeName);
+ wxUnusedVar(themePart);
+ wxUnusedVar(themeState);
+ wxUnusedVar(themeColour);
+#endif
+ return wxSystemSettings::GetColour(fallback);
+}
+
// ---------------------------------------------------------------------------
// painting
// ---------------------------------------------------------------------------
bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
{
- // standard non top level controls (i.e. except the dialogs) always erase
- // their background themselves in HandleCtlColor() or have some control-
- // specific ways to set the colours (common controls)
- if ( IsOfStandardClass() && !IsTopLevel() )
- return false;
-
switch ( GetBackgroundStyle() )
{
case wxBG_STYLE_ERASE:
+ case wxBG_STYLE_COLOUR:
// we need to generate an erase background event
{
wxDCTemp dc(hdc, GetClientSize());
if ( rc )
{
- // background erase by the user-defined handler
+ // background erased by the user-defined handler
return true;
}
}
break;
case wxBG_STYLE_PAINT:
+ case wxBG_STYLE_TRANSPARENT:
// no need to do anything here at all, background will be entirely
// redrawn in WM_PAINT handler
break;
}
WXHBRUSH
-wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), WXHWND hWnd)
+wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), wxWindowMSW *child)
{
if ( m_hasBgCol )
{
// children because it would look wrong if a child of non
// transparent child would show our bg colour when the child itself
// does not
- wxWindow *win = wxFindWinFromHandle(hWnd);
- if ( win == this ||
+ if ( child == this ||
m_inheritBgCol ||
- (win && win->HasTransparentBackground() &&
- win->GetParent() == this) )
+ (child->HasTransparentBackground() &&
+ child->GetParent() == this) )
{
// draw children with the same colour as the parent
wxBrush *
return 0;
}
-WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint)
+WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, wxWindowMSW *child)
{
- if ( !hWndToPaint )
- hWndToPaint = GetHWND();
-
for ( wxWindowMSW *win = this; win; win = win->GetParent() )
{
- WXHBRUSH hBrush = win->MSWGetBgBrushForChild(hDC, hWndToPaint);
+ WXHBRUSH hBrush = win->MSWGetBgBrushForChild(hDC, child);
if ( hBrush )
return hBrush;
return wxk;
}
-WXWORD wxCharCodeWXToMSW(int wxk, bool *isVirtual)
+WXWORD wxCharCodeWXToMSW(int wxk)
{
- if ( isVirtual )
- *isVirtual = true;
-
// check the table first
for ( size_t n = 0; n < WXSIZEOF(gs_specialKeys); n++ )
{
else
#endif // !__WXWINCE__
{
- if ( isVirtual )
- *isVirtual = false;
vk = (WXWORD)wxk;
}
}