Deleting column zero should only delete the column and not the item

data.
This commit is contained in:
Huw Davies 2004-04-21 22:25:04 +00:00 committed by Alexandre Julliard
parent 759ef45945
commit 69f2e04ff8

View File

@ -4229,13 +4229,9 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
|| nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
/* While the MSDN specifically says that column zero should not be deleted,
it does in fact work on WinNT, and at least one app depends on it. On
WinNT, deleting column zero deletes the last column of items but the
first header. Since no app will ever depend on that bizarre behavior,
we just delete the last column including the header.
what actually happens is that the column itself is deleted but no items or subitems
are removed.
*/
if (nColumn == 0)
nColumn = DPA_GetPtrCount(infoPtr->hdpaColumns) - 1;
LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol);
@ -4245,15 +4241,12 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
Free(DPA_GetPtr(infoPtr->hdpaColumns, nColumn));
DPA_DeletePtr(infoPtr->hdpaColumns, nColumn);
if (!(infoPtr->dwStyle & LVS_OWNERDATA))
if (!(infoPtr->dwStyle & LVS_OWNERDATA) && nColumn)
{
SUBITEM_INFO *lpSubItem, *lpDelItem;
HDPA hdpaSubItems;
INT nItem, nSubItem, i;
if (nColumn == 0)
return LISTVIEW_DeleteAllItems(infoPtr);
for (nItem = 0; nItem < infoPtr->nItemCount; nItem++)
{
hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem);
@ -4290,7 +4283,10 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
}
/* update the other column info */
LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left));
if(DPA_GetPtrCount(infoPtr->hdpaColumns) == 0)
LISTVIEW_InvalidateList(infoPtr);
else
LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left));
return TRUE;
}