From ccecc6542be625e787708a4b0c8f0ee8899f89f3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 13 Aug 2003 10:06:02 +0000 Subject: [PATCH] set LVCFMT_IMAGE, this at least allows to show imageso n the right sidei n the first column too (and fixes bug 787781) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@22787 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/listctrl.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 9c80f3c28e..acc083ef71 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1512,22 +1512,9 @@ long wxListCtrl::InsertColumn(long col, wxListItem& item) lvCol.cx = 80; } - // when we insert a column which can contain an image, we must specify this - // flag right now as doing it later in SetColumn() has no effect - // - // we use LVCFMT_BITMAP_ON_RIGHT by default because without it there is no - // way to dynamically set/clear the bitmap as the column without a bitmap - // on the left looks ugly (there is a hole) - // - // unfortunately with my version of comctl32.dll (5.80), the left column - // image is always on the left and it seems that it's a "feature" - I - // didn't find any way to work around it in any case - if ( lvCol.mask & LVCF_IMAGE ) - { - lvCol.mask |= LVCF_FMT; - lvCol.fmt |= LVCFMT_BITMAP_ON_RIGHT; - } - + // NB: this is wrong, according to the docs we should return the index of + // the new column and not a bool, but don't change it in 2.4 branch + // as it's an incompatible change risking to break people's code bool success = ListView_InsertColumn(GetHwnd(), col, &lvCol) != -1; if ( success ) { @@ -2658,7 +2645,17 @@ static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item, { if ( wxTheApp->GetComCtl32Version() >= 470 ) { - lvCol.mask |= LVCF_IMAGE; + lvCol.mask |= LVCF_IMAGE | LVCF_FMT; + + // we use LVCFMT_BITMAP_ON_RIGHT because thei mages on the right + // 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) + // + // we don't use LVCFMT_COL_HAS_IMAGES because it doesn't seem to + // make any difference in my tests -- but maybe we should? + lvCol.fmt |= LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE; + lvCol.iImage = item.m_image; } //else: it doesn't support item images anyhow