Fix custom draw for item 0.

This commit is contained in:
Dimitrie O. Paun 2003-05-11 03:29:25 +00:00 committed by Alexandre Julliard
parent 0955adfc2e
commit c6e988eaa0
1 changed files with 10 additions and 3 deletions

View File

@ -858,7 +858,7 @@ static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, LISTVIEW_INFO *infoPtr, HD
lpnmlvcd->clrTextBk = infoPtr->clrTextBk; lpnmlvcd->clrTextBk = infoPtr->clrTextBk;
lpnmlvcd->clrText = infoPtr->clrText; lpnmlvcd->clrText = infoPtr->clrText;
if (!lplvItem) return; if (!lplvItem) return;
lpnmlvcd->nmcd.dwItemSpec = lplvItem->iItem; lpnmlvcd->nmcd.dwItemSpec = lplvItem->iItem + 1;
lpnmlvcd->iSubItem = lplvItem->iSubItem; lpnmlvcd->iSubItem = lplvItem->iSubItem;
if (lplvItem->state & LVIS_SELECTED) lpnmlvcd->nmcd.uItemState |= CDIS_SELECTED; if (lplvItem->state & LVIS_SELECTED) lpnmlvcd->nmcd.uItemState |= CDIS_SELECTED;
if (lplvItem->state & LVIS_FOCUSED) lpnmlvcd->nmcd.uItemState |= CDIS_FOCUS; if (lplvItem->state & LVIS_FOCUSED) lpnmlvcd->nmcd.uItemState |= CDIS_FOCUS;
@ -868,9 +868,16 @@ static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, LISTVIEW_INFO *infoPtr, HD
static inline DWORD notify_customdraw (LISTVIEW_INFO *infoPtr, DWORD dwDrawStage, NMLVCUSTOMDRAW *lpnmlvcd) static inline DWORD notify_customdraw (LISTVIEW_INFO *infoPtr, DWORD dwDrawStage, NMLVCUSTOMDRAW *lpnmlvcd)
{ {
BOOL isForItem = (lpnmlvcd->nmcd.dwItemSpec != 0);
DWORD result;
lpnmlvcd->nmcd.dwDrawStage = dwDrawStage; lpnmlvcd->nmcd.dwDrawStage = dwDrawStage;
if (lpnmlvcd->nmcd.dwItemSpec) lpnmlvcd->nmcd.dwDrawStage |= CDDS_ITEM; if (isForItem) lpnmlvcd->nmcd.dwDrawStage |= CDDS_ITEM;
return notify_hdr(infoPtr, NM_CUSTOMDRAW, &lpnmlvcd->nmcd.hdr); if (lpnmlvcd->iSubItem) lpnmlvcd->nmcd.dwDrawStage |= CDDS_SUBITEM;
if (isForItem) lpnmlvcd->nmcd.dwItemSpec--;
result = notify_hdr(infoPtr, NM_CUSTOMDRAW, &lpnmlvcd->nmcd.hdr);
if (isForItem) lpnmlvcd->nmcd.dwItemSpec++;
return result;
} }
static DWORD notify_prepaint (LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd) static DWORD notify_prepaint (LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd)