X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6f806543a4e26b02acbfdc8e6eac5b4e0ac6ab29..abfcca57dd0d805ceec9e19c4be207614d79252a:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index fbf22fa5dd..c527a6f0d3 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -101,6 +101,14 @@ #define HDM_GETITEMRECT (HDM_FIRST+7) #endif +#ifndef LVCF_IMAGE + #define LVCF_IMAGE 0x0010 +#endif + +#ifndef LVCFMT_BITMAP_ON_RIGHT + #define LVCFMT_BITMAP_ON_RIGHT 0x1000 +#endif + // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -1041,13 +1049,41 @@ bool wxListCtrl::Arrange(int flag) // Deletes an item bool wxListCtrl::DeleteItem(long item) { - return (ListView_DeleteItem(GetHwnd(), (int) item) != 0); + if ( !ListView_DeleteItem(GetHwnd(), (int) item) ) + { + wxLogLastError(_T("ListView_DeleteItem")); + return FALSE; + } + + // the virtual list control doesn't refresh itself correctly, help it + if ( IsVirtual() ) + { + // we need to refresh all the lines below the one which was deleted + wxRect rectItem; + if ( item > 0 && GetItemCount() ) + { + GetItemRect(item - 1, rectItem); + } + else + { + rectItem.y = + rectItem.height = 0; + } + + wxRect rectWin = GetRect(); + rectWin.height = rectWin.GetBottom() - rectItem.GetBottom(); + rectWin.y = rectItem.GetBottom(); + + RefreshRect(rectWin); + } + + return TRUE; } // Deletes all items bool wxListCtrl::DeleteAllItems() { - return (ListView_DeleteAllItems(GetHwnd()) != 0); + return ListView_DeleteAllItems(GetHwnd()) != 0; } // Deletes all items @@ -1596,7 +1632,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { eventType = wxEVT_COMMAND_LIST_END_LABEL_EDIT; LV_DISPINFO *info = (LV_DISPINFO *)lParam; - wxConvertFromMSWListItem(GetHwnd(), event.m_item, info->item); + wxConvertFromMSWListItem(NULL, event.m_item, info->item); if ( info->item.pszText == NULL || info->item.iItem == -1 ) return FALSE; @@ -1767,10 +1803,13 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxStrncpy(lvi.pszText, text, lvi.cchTextMax); } +#if defined(_WIN32_IE) && _WIN32_IE >= 0x300 \ + && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 1 ) ) if ( lvi.mask & LVIF_IMAGE ) { lvi.iImage = OnGetItemImage(item); } +#endif // a little dose of healthy paranoia: as we never use // LVM_SETCALLBACKMASK we're not supposed to get these ones @@ -2276,6 +2315,8 @@ static void wxConvertToMSWListCol(int col, const wxListItem& item, lvCol.cx = item.m_width; } +#if defined(_WIN32_IE) && _WIN32_IE >= 0x300 \ + && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 1 ) ) if ( item.m_mask & wxLIST_MASK_IMAGE ) { if ( wxTheApp->GetComCtl32Version() >= 470 ) @@ -2285,6 +2326,7 @@ static void wxConvertToMSWListCol(int col, const wxListItem& item, } //else: it doesn't support item images anyhow } +#endif } // ----------------------------------------------------------------------------