[COMCTL32][EXPLORER][UXTHEME] Properly draw the taskbar rebar when themes are enabled. Brought to you by Stefano Toncich aka Tonix. CORE-8901

svn path=/trunk/; revision=68111
This commit is contained in:
Amine Khaldi 2015-06-12 19:11:48 +00:00
parent 70a31e656a
commit 55ee8217db
5 changed files with 56 additions and 6 deletions

View file

@ -1447,6 +1447,7 @@ public:
LRESULT DrawBackground(HDC hdc) LRESULT DrawBackground(HDC hdc)
{ {
HRESULT res;
RECT rect; RECT rect;
GetClientRect(&rect); GetClientRect(&rect);
@ -1458,10 +1459,10 @@ public:
DrawThemeParentBackground(m_hWnd, hdc, &rect); DrawThemeParentBackground(m_hWnd, hdc, &rect);
} }
DrawThemeBackground(TrayTheme, hdc, TNP_BACKGROUND, 0, &rect, 0); res = DrawThemeBackground(TrayTheme, hdc, TNP_BACKGROUND, 0, &rect, 0);
} }
return TRUE; return res;
} }
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)

View file

@ -1838,6 +1838,7 @@ ChangePos:
{ {
RECT rect; RECT rect;
int partId; int partId;
HRESULT res;
GetClientRect(&rect); GetClientRect(&rect);
@ -1860,11 +1861,10 @@ ChangePos:
partId = TBP_BACKGROUNDBOTTOM; partId = TBP_BACKGROUNDBOTTOM;
break; break;
} }
res = DrawThemeBackground(m_Theme, hdc, partId, 0, &rect, 0);
DrawThemeBackground(m_Theme, hdc, partId, 0, &rect, 0);
} }
return TRUE; return res;
} }
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@ -1911,7 +1911,10 @@ ChangePos:
rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZEFRAME); rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZEFRAME);
break; break;
} }
if (IsThemeBackgroundPartiallyTransparent(m_Theme, backoundPart, 0))
{
DrawThemeParentBackground(m_hWnd, hdc, &rect);
}
DrawThemeBackground(m_Theme, hdc, backoundPart, 0, &rect, 0); DrawThemeBackground(m_Theme, hdc, backoundPart, 0, &rect, 0);
ReleaseDC(m_hWnd, hdc); ReleaseDC(m_hWnd, hdc);

View file

@ -1831,6 +1831,17 @@ static LRESULT REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc)
HRGN hrgn; HRGN hrgn;
GetClientRect (infoPtr->hwndSelf, &cr); GetClientRect (infoPtr->hwndSelf, &cr);
#ifdef __REACTOS__
if (theme)
{
if (IsThemeBackgroundPartiallyTransparent(theme, RP_BACKGROUND, 0))
{
DrawThemeParentBackground (infoPtr->hwndSelf, hdc, &cr);
}
DrawThemeBackground (theme, hdc, 0, 0, &cr, NULL);
}
#endif
hrgn = CreateRectRgn(cr.left, cr.top, cr.right, cr.bottom); hrgn = CreateRectRgn(cr.left, cr.top, cr.right, cr.bottom);
oldrow = -1; oldrow = -1;
@ -1921,6 +1932,9 @@ static LRESULT REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc)
#endif #endif
} }
#ifdef __REACTOS__
if (!theme)
#else
if (theme) if (theme)
{ {
/* When themed, the background color is ignored (but not a /* When themed, the background color is ignored (but not a
@ -1928,6 +1942,7 @@ static LRESULT REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc)
DrawThemeBackground (theme, hdc, 0, 0, &cr, &rcBand); DrawThemeBackground (theme, hdc, 0, 0, &cr, &rcBand);
} }
else else
#endif
{ {
old = SetBkColor (hdc, new); old = SetBkColor (hdc, new);
TRACE("%s background color=0x%06x, band %s\n", TRACE("%s background color=0x%06x, band %s\n",
@ -1945,6 +1960,9 @@ static LRESULT REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc)
} }
#if 1 #if 1
#ifdef __REACTOS__
if (!theme)
#endif
{ {
//FIXME: Apparently painting the remaining area is a v6 feature //FIXME: Apparently painting the remaining area is a v6 feature
HBRUSH hbrush = CreateSolidBrush(new); HBRUSH hbrush = CreateSolidBrush(new);
@ -3243,7 +3261,11 @@ REBAR_NCCalcSize (const REBAR_INFO *infoPtr, RECT *rect)
else if ((theme = GetWindowTheme (infoPtr->hwndSelf))) else if ((theme = GetWindowTheme (infoPtr->hwndSelf)))
{ {
/* FIXME: should use GetThemeInt */ /* FIXME: should use GetThemeInt */
#ifdef __REACTOS__
rect->top = (rect->top + 1 < rect->bottom) ? rect->top : rect->bottom;
#else
rect->top = min(rect->top + 1, rect->bottom); rect->top = min(rect->top + 1, rect->bottom);
#endif
} }
TRACE("new client=(%s)\n", wine_dbgstr_rect(rect)); TRACE("new client=(%s)\n", wine_dbgstr_rect(rect));
return 0; return 0;

View file

@ -2087,6 +2087,9 @@ BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId,
GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype); GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
#ifdef __REACTOS__
if (bgtype == BT_NONE) return TRUE;
#endif
if (bgtype != BT_IMAGEFILE) return FALSE; if (bgtype != BT_IMAGEFILE) return FALSE;
if(FAILED (UXTHEME_LoadImage (hTheme, 0, iPartId, iStateId, &rect, FALSE, if(FAILED (UXTHEME_LoadImage (hTheme, 0, iPartId, iStateId, &rect, FALSE,

View file

@ -763,6 +763,9 @@ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassList) PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassList)
{ {
PTHEME_CLASS cls = NULL; PTHEME_CLASS cls = NULL;
#ifdef __REACTOS__
PTHEME_CLASS defaultCls = NULL;
#endif
WCHAR szClassName[MAX_THEME_CLASS_NAME]; WCHAR szClassName[MAX_THEME_CLASS_NAME];
LPCWSTR start; LPCWSTR start;
LPCWSTR end; LPCWSTR end;
@ -779,10 +782,18 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR
start = end+1; start = end+1;
cls = MSSTYLES_FindClass(tf, pszAppName, szClassName); cls = MSSTYLES_FindClass(tf, pszAppName, szClassName);
if(cls) break; if(cls) break;
#ifdef __REACTOS__
if (!defaultCls)
defaultCls = MSSTYLES_FindClass(tf, NULL, szClassName);
#endif
} }
if(!cls && *start) { if(!cls && *start) {
lstrcpynW(szClassName, start, sizeof(szClassName)/sizeof(szClassName[0])); lstrcpynW(szClassName, start, sizeof(szClassName)/sizeof(szClassName[0]));
cls = MSSTYLES_FindClass(tf, pszAppName, szClassName); cls = MSSTYLES_FindClass(tf, pszAppName, szClassName);
#ifdef __REACTOS__
if (!defaultCls)
defaultCls = MSSTYLES_FindClass(tf, NULL, szClassName);
#endif
} }
if(cls) { if(cls) {
TRACE("Opened app %s, class %s from list %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName), debugstr_w(pszClassList)); TRACE("Opened app %s, class %s from list %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName), debugstr_w(pszClassList));
@ -790,6 +801,16 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR
cls->tf->dwRefCount++; cls->tf->dwRefCount++;
TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount); TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
} }
#ifdef __REACTOS__
else if (defaultCls)
{
cls = defaultCls;
TRACE("Opened default class %s from list %s\n", debugstr_w(cls->szClassName), debugstr_w(pszClassList));
cls->tf = tf;
cls->tf->dwRefCount++;
TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
}
#endif
return cls; return cls;
} }