https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f463ebe9e72646d400cf934d1f78a8d06ba08b66

commit f463ebe9e72646d400cf934d1f78a8d06ba08b66
Author: Giannis Adamopoulos <[email protected]>
AuthorDate: Wed Jan 10 23:29:20 2018 +0200

    [COMCTL32] -toolbar: Improve drawing diabled text with themes. CORE-13855
---
 dll/win32/comctl32/toolbar.c | 44 +++++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/dll/win32/comctl32/toolbar.c b/dll/win32/comctl32/toolbar.c
index 8f78b2c792..0fb910017e 100644
--- a/dll/win32/comctl32/toolbar.c
+++ b/dll/win32/comctl32/toolbar.c
@@ -627,6 +627,31 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT 
*rcText, LPCWSTR lpText,
               wine_dbgstr_rect(rcText));
 
        hOldFont = SelectObject (hdc, infoPtr->hFont);
+#ifdef __REACTOS__
+    if (theme)
+    {
+        DWORD dwDTFlags2 = 0;
+        int partId = TP_BUTTON;
+        int stateId = TS_NORMAL;
+
+        if (state & CDIS_DISABLED)
+        {
+            stateId = TS_DISABLED;
+            dwDTFlags2 = DTT_GRAYED;
+        }
+        else if (state & CDIS_SELECTED)
+            stateId = TS_PRESSED;
+        else if (state & CDIS_CHECKED)
+            stateId = (state & CDIS_HOT) ? TS_HOTCHECKED : TS_HOT;
+        else if (state & CDIS_HOT)
+            stateId = TS_HOT;
+
+        DrawThemeText(theme, hdc, partId, stateId, lpText, -1, 
infoPtr->dwDTFlags, dwDTFlags2, rcText);
+        SelectObject (hdc, hOldFont);
+        return;
+    }
+#endif
+
        if ((state & CDIS_HOT) && (dwItemCDFlag & TBCDRF_HILITEHOTTRACK )) {
            clrOld = SetTextColor (hdc, tbcd->clrTextHighlight);
        }
@@ -649,25 +674,6 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT 
*rcText, LPCWSTR lpText,
            clrOld = SetTextColor (hdc, tbcd->clrText);
        }
 
-#ifdef __REACTOS__
-    if (theme)
-    {
-        int partId = TP_BUTTON;
-        int stateId = TS_NORMAL;
-
-        if (state & CDIS_DISABLED)
-            stateId = TS_DISABLED;
-        else if (state & CDIS_SELECTED)
-            stateId = TS_PRESSED;
-        else if (state & CDIS_CHECKED)
-            stateId = (state & CDIS_HOT) ? TS_HOTCHECKED : TS_HOT;
-        else if (state & CDIS_HOT)
-            stateId = TS_HOT;
-
-        DrawThemeText(theme, hdc, partId, stateId, lpText, -1, 
infoPtr->dwDTFlags, 0, rcText);
-    }
-    else
-#endif
        DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
        SetTextColor (hdc, clrOld);
        if ((state & CDIS_MARKED) && !(dwItemCDFlag & TBCDRF_NOMARK))

Reply via email to