Module: wine Branch: master Commit: d2c9a5cfae5251ba03cf6ff639012a2a9216a39b URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2c9a5cfae5251ba03cf6ff639...
Author: Piotr Caban piotr@codeweavers.com Date: Mon Jun 27 14:21:59 2011 +0200
comctl32: Improved setting button state.
---
dlls/comctl32/theme_button.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/theme_button.c b/dlls/comctl32/theme_button.c index 488c751..90e1172 100644 --- a/dlls/comctl32/theme_button.c +++ b/dlls/comctl32/theme_button.c @@ -246,18 +246,26 @@ static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC) DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE); DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE); UINT dtFlags = get_drawtext_flags(dwStyle, dwStyleEx); - ButtonState drawState = IsWindowEnabled(hwnd) ? STATE_NORMAL : STATE_DISABLED; + int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0); + ButtonState drawState; pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
- if (paint) + if(!paint) + return FALSE; + + if(IsWindowEnabled(hwnd)) { - hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps); - paint(theme, hwnd, hDC, drawState, dtFlags); - if (!hParamDC) EndPaint(hwnd, &ps); - return TRUE; + if(state & BST_PUSHED) drawState = STATE_PRESSED; + else if(state & BST_HOT) drawState = STATE_HOT; + else if(state & BST_FOCUS) drawState = STATE_DEFAULTED; + else drawState = STATE_NORMAL; } + else drawState = STATE_DISABLED;
- return FALSE; /* Delegate drawing to the non-themed code. */ + hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps); + paint(theme, hwnd, hDC, drawState, dtFlags); + if (!hParamDC) EndPaint(hwnd, &ps); + return TRUE; }
/**********************************************************************