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
This commit is contained in:
Vadim Zeitlin
2003-08-13 10:06:02 +00:00
parent 6d8baa7536
commit ccecc6542b

View File

@@ -1512,22 +1512,9 @@ long wxListCtrl::InsertColumn(long col, wxListItem& item)
lvCol.cx = 80; lvCol.cx = 80;
} }
// when we insert a column which can contain an image, we must specify this // NB: this is wrong, according to the docs we should return the index of
// flag right now as doing it later in SetColumn() has no effect // 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
// 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;
}
bool success = ListView_InsertColumn(GetHwnd(), col, &lvCol) != -1; bool success = ListView_InsertColumn(GetHwnd(), col, &lvCol) != -1;
if ( success ) if ( success )
{ {
@@ -2658,7 +2645,17 @@ static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item,
{ {
if ( wxTheApp->GetComCtl32Version() >= 470 ) 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; lvCol.iImage = item.m_image;
} }
//else: it doesn't support item images anyhow //else: it doesn't support item images anyhow