comctl32/button: Implement NM_CUSTOMDRAW for themed Push Buttons.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=10531 Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4b85740ebf
commit
3062a594bd
|
@ -1904,19 +1904,50 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
|
|||
HFONT font = infoPtr->font;
|
||||
HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
|
||||
WCHAR *text = get_button_text(infoPtr);
|
||||
NMCUSTOMDRAW nmcd;
|
||||
LRESULT cdrf;
|
||||
HWND parent;
|
||||
|
||||
GetClientRect(infoPtr->hwnd, &bgRect);
|
||||
GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect);
|
||||
init_custom_draw(&nmcd, infoPtr, hDC, &bgRect);
|
||||
|
||||
parent = GetParent(infoPtr->hwnd);
|
||||
if (!parent) parent = infoPtr->hwnd;
|
||||
|
||||
/* Send erase notifications */
|
||||
cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
|
||||
if (cdrf & CDRF_SKIPDEFAULT) goto cleanup;
|
||||
|
||||
if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state))
|
||||
DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
|
||||
DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
|
||||
|
||||
if (cdrf & CDRF_NOTIFYPOSTERASE)
|
||||
{
|
||||
nmcd.dwDrawStage = CDDS_POSTERASE;
|
||||
SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
|
||||
}
|
||||
|
||||
/* Send paint notifications */
|
||||
nmcd.dwDrawStage = CDDS_PREPAINT;
|
||||
cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
|
||||
if (cdrf & CDRF_SKIPDEFAULT) goto cleanup;
|
||||
|
||||
if (text)
|
||||
{
|
||||
DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);
|
||||
if (!(cdrf & CDRF_DOERASE))
|
||||
DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);
|
||||
heap_free(text);
|
||||
}
|
||||
|
||||
if (cdrf & CDRF_NOTIFYPOSTPAINT)
|
||||
{
|
||||
nmcd.dwDrawStage = CDDS_POSTPAINT;
|
||||
SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
|
||||
}
|
||||
if (cdrf & CDRF_SKIPPOSTPAINT) goto cleanup;
|
||||
|
||||
if (focused)
|
||||
{
|
||||
MARGINS margins;
|
||||
|
@ -1932,6 +1963,7 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
|
|||
DrawFocusRect( hDC, &focusRect );
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (hPrevFont) SelectObject(hDC, hPrevFont);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue