X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3709456403aecdfda30023f06516e3be4f3c8d94..b2da87c3169f29e3e0a317e8de12f6de045e4126:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 93187c0e42..524a9413f4 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -110,7 +110,12 @@ private: m_item = new LV_ITEM((LV_ITEM&)item); if ( (item.mask & LVIF_TEXT) && item.pszText ) { +#ifdef __WXWINE__ + // FIXME + m_buf = new wxWC2WXbuf(wxConvLocal.cWC2WX((const __wchar_t* ) item.pszText)); +#else m_buf = new wxWC2WXbuf(wxConvLocal.cWC2WX(item.pszText)); +#endif m_item->pszText = (wxChar*)m_buf->data(); } else @@ -598,7 +603,7 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const lvCol.mask |= LVCF_IMAGE; } - bool success = ListView_GetColumn(GetHwnd(), col, & lvCol) != 0; + bool success = ListView_GetColumn(GetHwnd(), col, &lvCol) != 0; // item.m_subItem = lvCol.iSubItem; item.m_width = lvCol.cx; @@ -611,18 +616,28 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const if ( item.m_mask & wxLIST_MASK_FORMAT ) { - if (lvCol.fmt == LVCFMT_LEFT) - item.m_format = wxLIST_FORMAT_LEFT; - else if (lvCol.fmt == LVCFMT_RIGHT) - item.m_format = wxLIST_FORMAT_RIGHT; - else if (lvCol.fmt == LVCFMT_CENTER) - item.m_format = wxLIST_FORMAT_CENTRE; + switch (lvCol.fmt & LVCFMT_JUSTIFYMASK) { + case LVCFMT_LEFT: + item.m_format = wxLIST_FORMAT_LEFT; + break; + case LVCFMT_RIGHT: + item.m_format = wxLIST_FORMAT_RIGHT; + break; + case LVCFMT_CENTER: + item.m_format = wxLIST_FORMAT_CENTRE; + break; + default: + item.m_format = -1; // Unknown? + break; + } } +#if _WIN32_IE >= 0x0300 if ( item.m_mask & wxLIST_MASK_IMAGE ) { item.m_image = lvCol.iImage; } +#endif return success; } @@ -960,11 +975,7 @@ bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const codeWin = LVIR_BOUNDS; } -#ifdef __WXWINE__ - bool success = ListView_GetItemRect(GetHwnd(), (int) item, &rectWin ) != 0; -#else bool success = ListView_GetItemRect(GetHwnd(), (int) item, &rectWin, codeWin) != 0; -#endif rect.x = rectWin.left; rect.y = rectWin.top; @@ -1311,14 +1322,22 @@ long wxListCtrl::FindItem(long start, const wxString& str, bool partial) // Find an item whose data matches this data, starting from the item after 'start' // or the beginning if 'start' is -1. +// NOTE : Lindsay Mathieson - 14-July-2002 +// No longer use ListView_FindItem as the data attribute is now stored +// in a wxListItemInternalData structure refernced by the actual lParam long wxListCtrl::FindItem(long start, long data) { - LV_FINDINFO findInfo; + long idx = start + 1; + long count = GetItemCount(); - findInfo.flags = LVFI_PARAM; - findInfo.lParam = data; + while (idx < count) + { + if (GetItemData(idx) == data) + return idx; + idx++; + }; - return ListView_FindItem(GetHwnd(), (int) start, & findInfo); + return -1; } // Find an item nearest this position in the specified direction, starting from @@ -2193,7 +2212,7 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) { int colWidth = GetColumnWidth(col); x += colWidth ; - dc.DrawLine(x, firstItemRect.GetY() - 2, x, itemRect.GetBottom()); + dc.DrawLine(x-1, firstItemRect.GetY() - 2, x-1, itemRect.GetBottom()); } } }