]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
make --static flag act on --cppflags too.
[wxWidgets.git] / src / msw / listctrl.cpp
index 3f61a72c3404aa349ad767b209cd9ec1827afdab..c527a6f0d387454d4ee9c8f77f168e48f9d382fb 100644 (file)
@@ -1049,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
@@ -1604,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;