Commit 89d4472d authored by Chris Morgan's avatar Chris Morgan Committed by Alexandre Julliard

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.
parent 04996dda
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
* LISTVIEW_GetHotCursor : not implemented * LISTVIEW_GetHotCursor : not implemented
* LISTVIEW_GetISearchString : not implemented * LISTVIEW_GetISearchString : not implemented
* LISTVIEW_GetBkImage : not implemented * LISTVIEW_GetBkImage : not implemented
* LISTVIEW_SetBkImage : not implemented
* LISTVIEW_GetColumnOrderArray : simple hack only * LISTVIEW_GetColumnOrderArray : simple hack only
* LISTVIEW_SetColumnOrderArray : simple hack only * LISTVIEW_SetColumnOrderArray : simple hack only
* LISTVIEW_Arrange : empty stub * LISTVIEW_Arrange : empty stub
...@@ -1161,7 +1162,7 @@ static INT LISTVIEW_GetItemHeight(HWND hwnd) ...@@ -1161,7 +1162,7 @@ static INT LISTVIEW_GetItemHeight(HWND hwnd)
{ {
nItemHeight = infoPtr->iconSpacing.cy; nItemHeight = infoPtr->iconSpacing.cy;
} }
else else
{ {
TEXTMETRICA tm; TEXTMETRICA tm;
HDC hdc = GetDC(hwnd); HDC hdc = GetDC(hwnd);
...@@ -7042,28 +7043,30 @@ static LRESULT LISTVIEW_SetHoverTime(HWND hwnd, DWORD dwHoverTime) ...@@ -7042,28 +7043,30 @@ static LRESULT LISTVIEW_SetHoverTime(HWND hwnd, DWORD dwHoverTime)
static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl) static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl)
{ {
LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
HIMAGELIST himlTemp = 0; HIMAGELIST himlOld = 0;
switch (nType) switch (nType)
{ {
case LVSIL_NORMAL: case LVSIL_NORMAL:
himlTemp = infoPtr->himlNormal; himlOld = infoPtr->himlNormal;
infoPtr->himlNormal = himl; infoPtr->himlNormal = himl;
return (LRESULT)himlTemp; break;
case LVSIL_SMALL: case LVSIL_SMALL:
himlTemp = infoPtr->himlSmall; himlOld = infoPtr->himlSmall;
infoPtr->himlSmall = himl; infoPtr->himlSmall = himl;
return (LRESULT)himlTemp; break;
case LVSIL_STATE: case LVSIL_STATE:
himlTemp = infoPtr->himlState; himlOld = infoPtr->himlState;
infoPtr->himlState = himl; infoPtr->himlState = himl;
ImageList_SetBkColor(infoPtr->himlState, CLR_NONE); 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) ...@@ -7448,6 +7451,12 @@ static LRESULT LISTVIEW_SortItems(HWND hwnd, WPARAM wParam, LPARAM lParam)
DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompare, hwnd); DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompare, hwnd);
} }
/* align the items */
LISTVIEW_AlignTop(hwnd);
/* refresh the display */
InvalidateRect(hwnd, NULL, TRUE);
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment