From 777a9ec12a09bb3a6c235bf5f4bfdcdf8326f76a Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Fri, 24 Feb 2017 22:47:59 +0000 Subject: [PATCH] [COMCTL32] -Draw button with classic style if BM_SETIMAGE was used. svn path=/trunk/; revision=73897 --- reactos/dll/win32/comctl32/theme_button.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/comctl32/theme_button.c b/reactos/dll/win32/comctl32/theme_button.c index b73c0a0b83d..6f55b4ff6eb 100644 --- a/reactos/dll/win32/comctl32/theme_button.c +++ b/reactos/dll/win32/comctl32/theme_button.c @@ -38,6 +38,7 @@ typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState draw #define STATE_GWL_OFFSET 0 #define HFONT_GWL_OFFSET (sizeof(LONG)) +#define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET+sizeof(HFONT)) static inline LONG get_button_state( HWND hwnd ) { @@ -320,15 +321,25 @@ static const pfThemedPaint btnThemedPaintFunc[BUTTON_TYPE + 1] = BOOL BUTTON_PaintWithTheme(HTHEME theme, HWND hwnd, HDC hParamDC, LPARAM prfFlag) { - DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE); - DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE); - UINT dtFlags = get_drawtext_flags(dwStyle, dwStyleEx); - int state = get_button_state(hwnd); + DWORD dwStyle; + DWORD dwStyleEx; + UINT dtFlags; + int state; ButtonState drawState; - pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ]; + pfThemedPaint paint; + + dwStyle = GetWindowLongW(hwnd, GWL_STYLE); + paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ]; if (!paint) return FALSE; + if (GetWindowLongPtrW( hwnd, HIMAGE_GWL_OFFSET) != 0) + return FALSE; + + dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE); + dtFlags = get_drawtext_flags(dwStyle, dwStyleEx); + state = get_button_state(hwnd); + if(IsWindowEnabled(hwnd)) { if(state & BST_PUSHED) drawState = STATE_PRESSED; -- 2.17.1