comctl32/listview: Always use large icon size when calculating icon spacing.
This commit is contained in:
parent
cb77ab1a00
commit
aeefa82185
|
@ -8586,18 +8586,18 @@ static DWORD LISTVIEW_SetHoverTime(LISTVIEW_INFO *infoPtr, DWORD dwHoverTime)
|
||||||
*/
|
*/
|
||||||
static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
|
static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
|
||||||
{
|
{
|
||||||
|
INT iconWidth = 0, iconHeight = 0;
|
||||||
DWORD oldspacing = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy);
|
DWORD oldspacing = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy);
|
||||||
|
|
||||||
TRACE("requested=(%d,%d)\n", cx, cy);
|
TRACE("requested=(%d,%d)\n", cx, cy);
|
||||||
|
|
||||||
/* this is supported only for LVS_ICON style */
|
|
||||||
if (infoPtr->uView != LV_VIEW_ICON) return oldspacing;
|
|
||||||
|
|
||||||
/* set to defaults, if instructed to */
|
/* set to defaults, if instructed to */
|
||||||
if (cx == -1 && cy == -1)
|
if (cx == -1 && cy == -1)
|
||||||
{
|
{
|
||||||
cx = GetSystemMetrics(SM_CXICONSPACING) - GetSystemMetrics(SM_CXICON) + infoPtr->iconSize.cx;
|
if (infoPtr->himlNormal)
|
||||||
cy = GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON) + infoPtr->iconSize.cy;
|
ImageList_GetIconSize(infoPtr->himlNormal, &iconWidth, &iconHeight);
|
||||||
|
cx = GetSystemMetrics(SM_CXICONSPACING) - GetSystemMetrics(SM_CXICON) + iconWidth;
|
||||||
|
cy = GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON) + iconHeight;
|
||||||
}
|
}
|
||||||
/* if 0 then keep width */
|
/* if 0 then keep width */
|
||||||
if (cx != 0)
|
if (cx != 0)
|
||||||
|
@ -9054,7 +9054,6 @@ static BOOL LISTVIEW_SetUnicodeFormat( LISTVIEW_INFO *infoPtr, BOOL unicode)
|
||||||
*/
|
*/
|
||||||
static INT LISTVIEW_SetView(LISTVIEW_INFO *infoPtr, DWORD nView)
|
static INT LISTVIEW_SetView(LISTVIEW_INFO *infoPtr, DWORD nView)
|
||||||
{
|
{
|
||||||
SIZE oldIconSize = infoPtr->iconSize;
|
|
||||||
HIMAGELIST himl;
|
HIMAGELIST himl;
|
||||||
|
|
||||||
if (infoPtr->uView == nView) return 1;
|
if (infoPtr->uView == nView) return 1;
|
||||||
|
@ -9080,14 +9079,6 @@ static INT LISTVIEW_SetView(LISTVIEW_INFO *infoPtr, DWORD nView)
|
||||||
switch (nView)
|
switch (nView)
|
||||||
{
|
{
|
||||||
case LV_VIEW_ICON:
|
case LV_VIEW_ICON:
|
||||||
if ((infoPtr->iconSize.cx != oldIconSize.cx) || (infoPtr->iconSize.cy != oldIconSize.cy))
|
|
||||||
{
|
|
||||||
TRACE("icon old size=(%d,%d), new size=(%d,%d)\n",
|
|
||||||
oldIconSize.cx, oldIconSize.cy, infoPtr->iconSize.cx, infoPtr->iconSize.cy);
|
|
||||||
LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
|
|
||||||
}
|
|
||||||
LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
|
|
||||||
break;
|
|
||||||
case LV_VIEW_SMALLICON:
|
case LV_VIEW_SMALLICON:
|
||||||
LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
|
LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
|
||||||
break;
|
break;
|
||||||
|
@ -11016,7 +11007,6 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
|
||||||
|
|
||||||
if (uNewView != uOldView)
|
if (uNewView != uOldView)
|
||||||
{
|
{
|
||||||
SIZE oldIconSize = infoPtr->iconSize;
|
|
||||||
HIMAGELIST himl;
|
HIMAGELIST himl;
|
||||||
|
|
||||||
SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
|
SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
|
||||||
|
@ -11028,16 +11018,7 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
|
||||||
himl = (uNewView == LVS_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
|
himl = (uNewView == LVS_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
|
||||||
set_icon_size(&infoPtr->iconSize, himl, uNewView != LVS_ICON);
|
set_icon_size(&infoPtr->iconSize, himl, uNewView != LVS_ICON);
|
||||||
|
|
||||||
if (uNewView == LVS_ICON)
|
if (uNewView == LVS_REPORT)
|
||||||
{
|
|
||||||
if ((infoPtr->iconSize.cx != oldIconSize.cx) || (infoPtr->iconSize.cy != oldIconSize.cy))
|
|
||||||
{
|
|
||||||
TRACE("icon old size=(%d,%d), new size=(%d,%d)\n",
|
|
||||||
oldIconSize.cx, oldIconSize.cy, infoPtr->iconSize.cx, infoPtr->iconSize.cy);
|
|
||||||
LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (uNewView == LVS_REPORT)
|
|
||||||
{
|
{
|
||||||
HDLAYOUT hl;
|
HDLAYOUT hl;
|
||||||
WINDOWPOS wp;
|
WINDOWPOS wp;
|
||||||
|
|
|
@ -4656,6 +4656,16 @@ static void test_getitemspacing(void)
|
||||||
expect(cx, LOWORD(ret));
|
expect(cx, LOWORD(ret));
|
||||||
expect(cy, HIWORD(ret));
|
expect(cy, HIWORD(ret));
|
||||||
|
|
||||||
|
/* spacing does not depend on selected view type */
|
||||||
|
ret = SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl40);
|
||||||
|
expect(0, ret);
|
||||||
|
|
||||||
|
ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0);
|
||||||
|
/* spacing + icon size returned */
|
||||||
|
expect(cx + 40, LOWORD(ret));
|
||||||
|
expect(cy + 40, HIWORD(ret));
|
||||||
|
|
||||||
|
SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0);
|
||||||
ImageList_Destroy(himl40);
|
ImageList_Destroy(himl40);
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
/* LVS_REPORT */
|
/* LVS_REPORT */
|
||||||
|
|
Loading…
Reference in New Issue