mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[COMCTL32]: Fix all tests for BCM_GETIDEALSIZE that we have so far. (It still returns a wrong result for the start button with lautus).
svn path=/trunk/; revision=74037
This commit is contained in:
parent
b3ba96d405
commit
bf0e8e0bcb
1 changed files with 14 additions and 9 deletions
|
@ -315,16 +315,13 @@ BOOL BUTTON_GetIdealSize(HTHEME theme, HWND hwnd, SIZE* psize)
|
|||
WCHAR *text;
|
||||
HFONT hFont = 0, hPrevFont = 0;
|
||||
SIZE TextSize, ImageSize, ButtonSize;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
pdata = _GetButtonData(hwnd);
|
||||
text = get_button_text( hwnd );
|
||||
hdc = GetDC(hwnd);
|
||||
if (!pdata || !text || !hdc || !text[0])
|
||||
{
|
||||
psize->cx = 100;
|
||||
psize->cy = 100;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* FIXME : Should use GetThemeTextExtent but unfortunately uses DrawTextW which is broken */
|
||||
if (theme)
|
||||
|
@ -381,6 +378,7 @@ BOOL BUTTON_GetIdealSize(HTHEME theme, HWND hwnd, SIZE* psize)
|
|||
}
|
||||
|
||||
*psize = ButtonSize;
|
||||
ret = TRUE;
|
||||
|
||||
cleanup:
|
||||
if (hFont)
|
||||
|
@ -390,7 +388,7 @@ cleanup:
|
|||
if (hdc)
|
||||
ReleaseDC(hwnd, hdc);
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -575,17 +573,24 @@ LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
|
|||
case BCM_GETIDEALSIZE:
|
||||
{
|
||||
HTHEME theme = GetWindowTheme(hWnd);
|
||||
BOOL ret = FALSE;
|
||||
SIZE* pSize = (SIZE*)lParam;
|
||||
|
||||
if (btn_type != BS_PUSHBUTTON && btn_type != BS_DEFPUSHBUTTON)
|
||||
if (btn_type == BS_PUSHBUTTON ||
|
||||
btn_type == BS_DEFPUSHBUTTON ||
|
||||
btn_type == BS_USERBUTTON)
|
||||
{
|
||||
ret = BUTTON_GetIdealSize(theme, hWnd, pSize);
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
SIZE* pSize = (SIZE*)lParam;
|
||||
GetClientRect(hWnd, &rect);
|
||||
pSize->cx = rect.right;
|
||||
pSize->cy = rect.bottom;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return BUTTON_GetIdealSize(theme, hWnd, (SIZE*)lParam);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue