From 89d4472d46a0c9073039614bffa53388f8c994ef Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Thu, 19 Oct 2000 20:22:09 +0000 Subject: [PATCH] Recalculate nItemHeight when LVS_SETIMAGELIST is called. Fixes icons being chopped off in the file dialog window. Align items to top and refresh after sorting, as windows does. --- dlls/comctl32/listview.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 0589cca643b..e2814e11ef6 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -31,6 +31,7 @@ * LISTVIEW_GetHotCursor : not implemented * LISTVIEW_GetISearchString : not implemented * LISTVIEW_GetBkImage : not implemented + * LISTVIEW_SetBkImage : not implemented * LISTVIEW_GetColumnOrderArray : simple hack only * LISTVIEW_SetColumnOrderArray : simple hack only * LISTVIEW_Arrange : empty stub @@ -1161,7 +1162,7 @@ static INT LISTVIEW_GetItemHeight(HWND hwnd) { nItemHeight = infoPtr->iconSpacing.cy; } - else + else { TEXTMETRICA tm; HDC hdc = GetDC(hwnd); @@ -7042,28 +7043,30 @@ static LRESULT LISTVIEW_SetHoverTime(HWND hwnd, DWORD dwHoverTime) static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl) { LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - HIMAGELIST himlTemp = 0; + HIMAGELIST himlOld = 0; switch (nType) { case LVSIL_NORMAL: - himlTemp = infoPtr->himlNormal; + himlOld = infoPtr->himlNormal; infoPtr->himlNormal = himl; - return (LRESULT)himlTemp; + break; case LVSIL_SMALL: - himlTemp = infoPtr->himlSmall; + himlOld = infoPtr->himlSmall; infoPtr->himlSmall = himl; - return (LRESULT)himlTemp; + break; case LVSIL_STATE: - himlTemp = infoPtr->himlState; + himlOld = infoPtr->himlState; infoPtr->himlState = himl; ImageList_SetBkColor(infoPtr->himlState, CLR_NONE); - return (LRESULT)himlTemp; + break; } - return (LRESULT)NULL; + infoPtr->nItemHeight = LISTVIEW_GetItemHeight(hwnd); + + return (LRESULT)himlOld; } @@ -7448,6 +7451,12 @@ static LRESULT LISTVIEW_SortItems(HWND hwnd, WPARAM wParam, LPARAM lParam) DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompare, hwnd); } + /* align the items */ + LISTVIEW_AlignTop(hwnd); + + /* refresh the display */ + InvalidateRect(hwnd, NULL, TRUE); + return TRUE; }