another custom draw fix: leave space for the image even if the current item doesn't have any but the list control has an image list (because this is what the standard drawing procedure does)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37814 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2006-03-05 12:12:11 +00:00
parent 13845bd57c
commit 25e6a4a698

View File

@ -2409,14 +2409,19 @@ static void HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont)
it.cchTextMax = WXSIZEOF(text);
ListView_GetItem(hwndList, &it);
if ( it.iImage != -1 )
HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL);
if ( himl && ImageList_GetImageCount(himl) )
{
HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL);
ImageList_Draw(himl, it.iImage, hdc, rc.left, rc.top,
nmcd.uItemState & CDIS_SELECTED ? ILD_SELECTED
: ILD_TRANSPARENT);
if ( it.iImage != -1 )
{
ImageList_Draw(himl, it.iImage, hdc, rc.left, rc.top,
nmcd.uItemState & CDIS_SELECTED ? ILD_SELECTED
: ILD_TRANSPARENT);
}
// notice that even if this item doesn't have any image, the list
// control still leaves space for the image if the image list is not
// empty (presumably so that items with and without images align?)
int wImage, hImage;
ImageList_GetIconSize(himl, &wImage, &hImage);