comctl32/listview: do not touch icon spacing if set explicitly
Daniel Jelinski
djelinski1 at gmail.com
Mon Feb 4 14:30:35 CST 2013
-------------- next part --------------
From 69b9e622237edcbc6c0202f7734cacb65585f70e Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Mon, 4 Feb 2013 20:49:55 +0100
Subject: comctl32/listview: do not touch icon spacing if set explicitly
---
dlls/comctl32/listview.c | 10 ++++++++--
dlls/comctl32/tests/listview.c | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 96863f9..bc8997a 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -55,7 +55,6 @@
* -- LVA_SNAPTOGRID not implemented
* -- LISTVIEW_ApproximateViewRect partially implemented
* -- LISTVIEW_SetColumnWidth ignores header images & bitmap
- * -- LISTVIEW_SetIconSpacing is incomplete
* -- LISTVIEW_StyleChanged doesn't handle some changes too well
*
* Speedups
@@ -290,6 +289,7 @@ typedef struct tagLISTVIEW_INFO
HIMAGELIST himlSmall;
HIMAGELIST himlState;
SIZE iconSize;
+ BOOL autoSpacing;
SIZE iconSpacing;
SIZE iconStateSize;
POINT currIconPos; /* this is the position next icon will be placed */
@@ -8594,11 +8594,15 @@ static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
/* set to defaults, if instructed to */
if (cx == -1 && cy == -1)
{
+ infoPtr->autoSpacing = TRUE;
if (infoPtr->himlNormal)
ImageList_GetIconSize(infoPtr->himlNormal, &iconWidth, &iconHeight);
cx = GetSystemMetrics(SM_CXICONSPACING) - GetSystemMetrics(SM_CXICON) + iconWidth;
cy = GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON) + iconHeight;
}
+ else
+ infoPtr->autoSpacing = FALSE;
+
/* if 0 then keep width */
if (cx != 0)
infoPtr->iconSpacing.cx = cx;
@@ -8660,7 +8664,8 @@ static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAG
himlOld = infoPtr->himlNormal;
infoPtr->himlNormal = himl;
if (infoPtr->uView == LV_VIEW_ICON) set_icon_size(&infoPtr->iconSize, himl, FALSE);
- LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
+ if (infoPtr->autoSpacing)
+ LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
break;
case LVSIL_SMALL:
@@ -9374,6 +9379,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->bRedraw = TRUE;
infoPtr->bNoItemMetrics = TRUE;
infoPtr->bDoChangeNotify = TRUE;
+ infoPtr->autoSpacing = TRUE;
infoPtr->iconSpacing.cx = GetSystemMetrics(SM_CXICONSPACING) - GetSystemMetrics(SM_CXICON);
infoPtr->iconSpacing.cy = GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON);
infoPtr->nEditLabelItem = -1;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index c46fe42..98ca495 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -4643,6 +4643,23 @@ static void test_getitemspacing(void)
SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl40);
ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0);
+ /* set size returned */
+ expect(100, LOWORD(ret));
+ expect(100, HIWORD(ret));
+
+ /* spacing = 0 - keep previous value */
+ ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELPARAM(0, -1));
+ expect(100, LOWORD(ret));
+ expect(100, HIWORD(ret));
+
+ ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0);
+ expect(100, LOWORD(ret));
+ expect(0xFFFF, HIWORD(ret));
+
+ ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, -1);
+ expect(100, LOWORD(ret));
+ expect(0xFFFF, HIWORD(ret));
+ ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0);
/* spacing + icon size returned */
expect(cx + 40, LOWORD(ret));
expect(cy + 40, HIWORD(ret));
--
1.7.5.4
More information about the wine-patches
mailing list