Commit d2c9a5cf authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

comctl32: Improved setting button state.

parent f831f775
...@@ -246,18 +246,26 @@ static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC) ...@@ -246,18 +246,26 @@ static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC)
DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE); DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE); DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE);
UINT dtFlags = get_drawtext_flags(dwStyle, dwStyleEx); 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 ]; pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
if (paint) if(!paint)
return FALSE;
if(IsWindowEnabled(hwnd))
{ {
hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps); if(state & BST_PUSHED) drawState = STATE_PRESSED;
paint(theme, hwnd, hDC, drawState, dtFlags); else if(state & BST_HOT) drawState = STATE_HOT;
if (!hParamDC) EndPaint(hwnd, &ps); else if(state & BST_FOCUS) drawState = STATE_DEFAULTED;
return TRUE; 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;
} }
/********************************************************************** /**********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment