set LVCFMT_IMAGE, this at least allows to show imageso n the right sidei n the first column too (and fixes bug 787781); corrected return value of InsertColumn()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-08-13 09:58:52 +00:00
parent f3858bf561
commit 8b3a401696

View File

@ -1499,34 +1499,18 @@ 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 long n = ListView_InsertColumn(GetHwnd(), col, &lvCol);
// flag right now as doing it later in SetColumn() has no effect if ( n != -1 )
//
// 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;
if ( success )
{ {
m_colCount++; m_colCount++;
} }
else else // failed to insert?
{ {
wxLogDebug(wxT("Failed to insert the column '%s' into listview!"), wxLogDebug(wxT("Failed to insert the column '%s' into listview!"),
lvCol.pszText); lvCol.pszText);
} }
return success; return n;
} }
long wxListCtrl::InsertColumn(long col, long wxListCtrl::InsertColumn(long col,
@ -2646,7 +2630,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
@ -2655,3 +2649,4 @@ static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item,
} }
#endif // wxUSE_LISTCTRL #endif // wxUSE_LISTCTRL