Fix bug when resetting wxListCtrl column header image in wxMSW

Set LVCFMT_IMAGE, meaning that the column just uses an image from the
image list, instead of LVCFMT_COL_HAS_IMAGES, meaning that the column
contains the image from the image list and do not set LVCF_IMAGE when
resetting the image, as this still reserved space for the (invalid)
image, resulting in an extra blank area in the column header.

Closes https://github.com/wxWidgets/wxWidgets/pull/1739

Closes #18617.
This commit is contained in:
followait
2020-03-12 23:54:29 +01:00
committed by Vadim Zeitlin
parent c4a95ab32c
commit 95eea38eb0

View File

@@ -3668,8 +3668,6 @@ static void wxConvertToMSWListCol(HWND hwndList,
if ( item.m_mask & wxLIST_MASK_IMAGE )
{
lvCol.mask |= LVCF_IMAGE;
// as we're going to overwrite the format field, get its
// current value first -- unless we want to overwrite it anyhow
if ( !(lvCol.mask & LVCF_FMT) )
@@ -3689,15 +3687,19 @@ static void wxConvertToMSWListCol(HWND hwndList,
// seem to be generally nicer than on the left and the generic
// version only draws them on the right (we don't have a flag to
// specify the image location anyhow)
const int fmtImage = LVCFMT_BITMAP_ON_RIGHT | LVCFMT_COL_HAS_IMAGES;
const int fmtImage = LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE;
if ( item.m_image != -1 )
{
lvCol.fmt |= fmtImage;
else // remove any existing image
lvCol.fmt &= ~fmtImage;
lvCol.mask |= LVCF_IMAGE;
lvCol.iImage = item.m_image;
}
else // remove any existing image
{
lvCol.fmt &= ~fmtImage;
}
}
}
#if wxUSE_TOOLTIPS