Commit b08c622e authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

comctl32/button: Turn off themed painting if parts are unavailable for Command Links.

Themed painting for Command Links requires BP_COMMANDLINK and BP_COMMANDLINKGLYPH to be defined in the theme. However, Wine currently only supports the v3 theme file format used by XP, which doesn't support Command Links. So turn off themed painting for Command Links if user uses a third party theme that doesn't have the required parts. Otherwise, only plain text is drawn. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d9b47aa3
......@@ -276,6 +276,20 @@ static LONG get_default_glyph_size(const BUTTON_INFO *infoPtr)
return GetSystemMetrics(SM_CYMENUCHECK);
}
static BOOL is_themed_paint_supported(HTHEME theme, UINT btn_type)
{
if (!theme || !btnThemedPaintFunc[btn_type])
return FALSE;
if (btn_type == BS_COMMANDLINK || btn_type == BS_DEFCOMMANDLINK)
{
if (!IsThemePartDefined(theme, BP_COMMANDLINK, 0))
return FALSE;
}
return TRUE;
}
static void init_custom_draw(NMCUSTOMDRAW *nmcd, const BUTTON_INFO *infoPtr, HDC hdc, const RECT *rc)
{
nmcd->hdr.hwndFrom = infoPtr->hwnd;
......@@ -548,7 +562,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
theme = GetWindowTheme( hWnd );
hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
if (theme && btnThemedPaintFunc[btn_type])
if (is_themed_paint_supported(theme, btn_type))
{
int drawState = get_draw_state(infoPtr);
UINT dtflags = BUTTON_BStoDT(style, GetWindowLongW(hWnd, GWL_EXSTYLE));
......
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