+static void wxConvertToMSWListCol(int col, const wxListItem& item,
+ LV_COLUMN& lvCol)
+{
+ wxZeroMemory(lvCol);
+
+ if ( item.m_mask & wxLIST_MASK_TEXT )
+ {
+ lvCol.mask |= LVCF_TEXT;
+ lvCol.pszText = (wxChar *)item.m_text.c_str(); // cast is safe
+ }
+
+ if ( item.m_mask & wxLIST_MASK_FORMAT )
+ {
+ lvCol.mask |= LVCF_FMT;
+
+ if ( item.m_format == wxLIST_FORMAT_LEFT )
+ lvCol.fmt = LVCFMT_LEFT;
+ else if ( item.m_format == wxLIST_FORMAT_RIGHT )
+ lvCol.fmt = LVCFMT_RIGHT;
+ else if ( item.m_format == wxLIST_FORMAT_CENTRE )
+ lvCol.fmt = LVCFMT_CENTER;
+ }
+
+ if ( item.m_mask & wxLIST_MASK_WIDTH )
+ {
+ lvCol.mask |= LVCF_WIDTH;
+ if ( item.m_width == wxLIST_AUTOSIZE)
+ lvCol.cx = LVSCW_AUTOSIZE;
+ else if ( item.m_width == wxLIST_AUTOSIZE_USEHEADER)
+ lvCol.cx = LVSCW_AUTOSIZE_USEHEADER;
+ else
+ lvCol.cx = item.m_width;
+ }
+
+#if defined(_WIN32_IE) && _WIN32_IE >= 0x300 \
+ && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) )
+ if ( item.m_mask & wxLIST_MASK_IMAGE )
+ {
+ if ( wxTheApp->GetComCtl32Version() >= 470 )
+ {
+ lvCol.mask |= LVCF_IMAGE;
+ lvCol.iImage = item.m_image;
+ }
+ //else: it doesn't support item images anyhow
+ }
+#endif
+}
+