Module: wine Branch: master Commit: f9c3a612af058429ce92aff3bdd9b942efe0f998 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f9c3a612af058429ce92aff3bd...
Author: Daniel Jelinski djelinski1@gmail.com Date: Mon Feb 4 20:49:55 2013 +0100
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));