[COMCTL32][EXPLORER][UXTHEME] Properly draw the taskbar rebar when themes are enabled...
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 12 Jun 2015 19:11:48 +0000 (19:11 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 12 Jun 2015 19:11:48 +0000 (19:11 +0000)
svn path=/trunk/; revision=68111

reactos/base/shell/explorer/trayntfy.cpp
reactos/base/shell/explorer/traywnd.cpp
reactos/dll/win32/comctl32/rebar.c
reactos/dll/win32/uxtheme/draw.c
reactos/dll/win32/uxtheme/msstyles.c

index a7a54ac..94613a7 100644 (file)
@@ -1447,6 +1447,7 @@ public:
 
     LRESULT DrawBackground(HDC hdc)
     {
+        HRESULT res;
         RECT rect;
 
         GetClientRect(&rect);
@@ -1458,10 +1459,10 @@ public:
                 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)
index dbbb0a4..b0e9c0a 100644 (file)
@@ -1838,6 +1838,7 @@ ChangePos:
     {
         RECT rect;
         int partId;
+        HRESULT res;
 
         GetClientRect(&rect);
 
@@ -1860,11 +1861,10 @@ ChangePos:
                 partId = TBP_BACKGROUNDBOTTOM;
                 break;
             }
-
-            DrawThemeBackground(m_Theme, hdc, partId, 0, &rect, 0);
+            res = DrawThemeBackground(m_Theme, hdc, partId, 0, &rect, 0);
         }
 
-        return TRUE;
+        return res;
     }
 
     LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -1911,7 +1911,10 @@ ChangePos:
             rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZEFRAME);
             break;
         }
-
+        if (IsThemeBackgroundPartiallyTransparent(m_Theme, backoundPart, 0))
+        {
+            DrawThemeParentBackground(m_hWnd, hdc, &rect);
+        }
         DrawThemeBackground(m_Theme, hdc, backoundPart, 0, &rect, 0);
 
         ReleaseDC(m_hWnd, hdc);
index 39950b9..52a1717 100644 (file)
@@ -1831,6 +1831,17 @@ static LRESULT REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc)
     HRGN hrgn;
 
     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);
 
     oldrow = -1;
@@ -1921,6 +1932,9 @@ static LRESULT REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc)
 #endif
        }
 
+#ifdef __REACTOS__
+        if (!theme)
+#else
         if (theme)
         {
             /* 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);
         }
         else
+#endif
         {
             old = SetBkColor (hdc, new);
             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
+#ifdef __REACTOS__
+    if (!theme)
+#endif
     {
         //FIXME: Apparently painting the remaining area is a v6 feature
         HBRUSH hbrush = CreateSolidBrush(new);
@@ -3243,7 +3261,11 @@ REBAR_NCCalcSize (const REBAR_INFO *infoPtr, RECT *rect)
     else if ((theme = GetWindowTheme (infoPtr->hwndSelf)))
     {
         /* 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);
+#endif
     }
     TRACE("new client=(%s)\n", wine_dbgstr_rect(rect));
     return 0;
index a507a42..cc178c1 100644 (file)
@@ -2087,6 +2087,9 @@ BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId,
 
     GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
 
+#ifdef __REACTOS__
+    if (bgtype == BT_NONE) return TRUE;
+#endif
     if (bgtype != BT_IMAGEFILE) return FALSE;
 
     if(FAILED (UXTHEME_LoadImage (hTheme, 0, iPartId, iStateId, &rect, FALSE, 
index cc2b352..f296996 100644 (file)
@@ -763,6 +763,9 @@ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
 PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassList)
 {
     PTHEME_CLASS cls = NULL;
+#ifdef __REACTOS__
+    PTHEME_CLASS defaultCls = NULL;
+#endif
     WCHAR szClassName[MAX_THEME_CLASS_NAME];
     LPCWSTR start;
     LPCWSTR end;
@@ -779,10 +782,18 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR
         start = end+1;
         cls = MSSTYLES_FindClass(tf, pszAppName, szClassName);
         if(cls) break;
+#ifdef __REACTOS__
+        if (!defaultCls)
+            defaultCls = MSSTYLES_FindClass(tf, NULL, szClassName);
+#endif
     }
     if(!cls && *start) {
         lstrcpynW(szClassName, start, sizeof(szClassName)/sizeof(szClassName[0]));
         cls = MSSTYLES_FindClass(tf, pszAppName, szClassName);
+#ifdef __REACTOS__
+        if (!defaultCls)
+            defaultCls = MSSTYLES_FindClass(tf, NULL, szClassName);
+#endif
     }
     if(cls) {
         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++;
     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;
 }