comctl32: Fix painting bug in listview control.

This commit is contained in:
Thomas Weidenmueller 2007-12-10 23:43:43 -07:00 committed by Alexandre Julliard
parent a526ad6cbc
commit 23dd46413c
1 changed files with 19 additions and 14 deletions

View File

@ -944,7 +944,7 @@ static inline DWORD notify_customdraw (const LISTVIEW_INFO *infoPtr, DWORD dwDra
return result;
}
static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd)
static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd, BOOL SubItem)
{
if (lpnmlvcd->clrTextBk == CLR_DEFAULT)
lpnmlvcd->clrTextBk = comctl32_color.clrWindow;
@ -952,6 +952,8 @@ static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRA
lpnmlvcd->clrText = comctl32_color.clrWindowText;
/* apprently, for selected items, we have to override the returned values */
if (!SubItem)
{
if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
{
if (infoPtr->bFocus)
@ -965,6 +967,7 @@ static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRA
lpnmlvcd->clrText = comctl32_color.clrBtnText;
}
}
}
/* Set the text attributes */
if (lpnmlvcd->clrTextBk != CLR_NONE)
@ -3787,7 +3790,9 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
if (cdsubitemmode & CDRF_SKIPDEFAULT) goto postpaint;
}
if (nSubItem == 0 || (cdmode & CDRF_NOTIFYITEMDRAW))
prepaint_setup(infoPtr, hdc, &nmlvcd);
prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);
else if ((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) == FALSE)
prepaint_setup(infoPtr, hdc, &nmlvcd, TRUE);
/* in full row select, subitems, will just use main item's colors */
if (nSubItem && uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
@ -3930,7 +3935,7 @@ static void LISTVIEW_RefreshOwnerDraw(const LISTVIEW_INFO *infoPtr, ITERATOR *i,
if (!(cditemmode & CDRF_SKIPDEFAULT))
{
prepaint_setup (infoPtr, hdc, &nmlvcd);
prepaint_setup (infoPtr, hdc, &nmlvcd, FALSE);
SendMessageW(infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
}
@ -4118,7 +4123,7 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra
customdraw_fill(&nmlvcd, infoPtr, hdc, &rcClient, 0);
cdmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd);
if (cdmode & CDRF_SKIPDEFAULT) goto enddraw;
prepaint_setup(infoPtr, hdc, &nmlvcd);
prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);
/* Use these colors to draw the items */
infoPtr->clrTextBk = nmlvcd.clrTextBk;