Zhiyi Zhang : comctl32/button: Support BS_PUSHLIKE for themed command links.

Alexandre Julliard julliard at winehq.org
Thu Nov 11 16:01:28 CST 2021


Module: wine
Branch: master
Commit: ce9d006a4511f36aeab4c0205c23725d0e03e730
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ce9d006a4511f36aeab4c0205c23725d0e03e730

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Thu Nov 11 15:04:26 2021 +0800

comctl32/button: Support BS_PUSHLIKE for themed command links.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/button.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index f158a7423b9..2e3d8912a66 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -3040,6 +3040,7 @@ static void CL_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
     NMCUSTOMDRAW nmcd;
     LRESULT cdrf;
     HWND parent;
+    int part;
     RECT rc;
 
     if (infoPtr->font) SelectObject(hDC, infoPtr->font);
@@ -3054,9 +3055,10 @@ static void CL_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
     cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
     if (cdrf & CDRF_SKIPDEFAULT) return;
 
-    if (IsThemeBackgroundPartiallyTransparent(theme, BP_COMMANDLINK, state))
+    part = GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & BS_PUSHLIKE ? BP_PUSHBUTTON : BP_COMMANDLINK;
+    if (IsThemeBackgroundPartiallyTransparent(theme, part, state))
         DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
-    DrawThemeBackground(theme, hDC, BP_COMMANDLINK, state, &rc, NULL);
+    DrawThemeBackground(theme, hDC, part, state, &rc, NULL);
 
     if (cdrf & CDRF_NOTIFYPOSTERASE)
     {
@@ -3076,7 +3078,7 @@ static void CL_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
         SIZE img_size;
         WCHAR *text;
 
-        GetThemeBackgroundContentRect(theme, hDC, BP_COMMANDLINK, state, &rc, &r);
+        GetThemeBackgroundContentRect(theme, hDC, part, state, &rc, &r);
 
         /* The text alignment and styles are fixed and don't depend on button styles */
         dtFlags = DT_TOP | DT_LEFT | DT_WORDBREAK;
@@ -3096,10 +3098,9 @@ static void CL_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
             UINT len = lstrlenW(text);
             RECT text_rect;
 
-            GetThemeTextExtent(theme, hDC, BP_COMMANDLINK, state, text, len,
-                               dtFlags | DT_END_ELLIPSIS, &r, &text_rect);
-            DrawThemeText(theme, hDC, BP_COMMANDLINK, state, text, len,
-                          dtFlags | DT_END_ELLIPSIS, 0, &r);
+            GetThemeTextExtent(theme, hDC, part, state, text, len, dtFlags | DT_END_ELLIPSIS, &r,
+                               &text_rect);
+            DrawThemeText(theme, hDC, part, state, text, len, dtFlags | DT_END_ELLIPSIS, 0, &r);
 
             txt_h = text_rect.bottom - text_rect.top;
             heap_free(text);
@@ -3114,8 +3115,7 @@ static void CL_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
             opts.dwSize = sizeof(opts);
             opts.dwFlags = DTT_FONTPROP;
             opts.iFontPropId = TMT_BODYFONT;
-            DrawThemeTextEx(theme, hDC, BP_COMMANDLINK, state,
-                            infoPtr->note, infoPtr->note_length,
+            DrawThemeTextEx(theme, hDC, part, state, infoPtr->note, infoPtr->note_length,
                             dtFlags | DT_NOPREFIX, &r, &opts);
         }
 




More information about the wine-cvs mailing list