+// convert our wxListItem to LV_COLUMN
+static void wxConvertToMSWListCol(int col, const wxListItem& item,
+ LV_COLUMN& lvCol);
+
+// ----------------------------------------------------------------------------
+// private helper classes
+// ----------------------------------------------------------------------------
+
+// We have to handle both fooW and fooA notifications in several cases
+// because of broken commctl.dll and/or unicows.dll. This class is used to
+// convert LV_ITEMA and LV_ITEMW to LV_ITEM (which is either LV_ITEMA or
+// LV_ITEMW depending on wxUSE_UNICODE setting), so that it can be processed
+// by wxConvertToMSWListItem().
+class wxLV_ITEM
+{
+public:
+ ~wxLV_ITEM() { delete m_buf; }
+ operator LV_ITEM&() const { return *m_item; }
+
+#if wxUSE_UNICODE
+ wxLV_ITEM(LV_ITEMW &item) : m_buf(NULL), m_item(&item) {}
+ wxLV_ITEM(LV_ITEMA &item)
+ {
+ m_item = new LV_ITEM((LV_ITEM&)item);
+ if ( (item.mask & LVIF_TEXT) && item.pszText )
+ {
+ m_buf = new wxMB2WXbuf(wxConvLocal.cMB2WX(item.pszText));
+ m_item->pszText = (wxChar*)m_buf->data();
+ }
+ else
+ m_buf = NULL;
+ }
+private:
+ wxMB2WXbuf *m_buf;
+
+#else
+ wxLV_ITEM(LV_ITEMW &item)
+ {
+ m_item = new LV_ITEM((LV_ITEM&)item);
+ if ( (item.mask & LVIF_TEXT) && item.pszText )
+ {
+ m_buf = new wxWC2WXbuf(wxConvLocal.cWC2WX(item.pszText));
+ m_item->pszText = (wxChar*)m_buf->data();
+ }
+ else
+ m_buf = NULL;
+ }
+ wxLV_ITEM(LV_ITEMA &item) : m_buf(NULL), m_item(&item) {}
+private:
+ wxWC2WXbuf *m_buf;
+#endif
+
+ LV_ITEM *m_item;
+};
+