Remember the global colors in custom draw mode.

This commit is contained in:
Dimitrie O. Paun 2002-10-16 19:05:43 +00:00 committed by Alexandre Julliard
parent ef9adbb6f5
commit 3dd4dabffb
1 changed files with 11 additions and 2 deletions

View File

@ -3471,7 +3471,7 @@ static void LISTVIEW_RefreshList(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD cdmode)
static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc) static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK; UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
COLORREF oldTextColor; COLORREF oldTextColor, oldClrTextBk, oldClrText;
NMLVCUSTOMDRAW nmlvcd; NMLVCUSTOMDRAW nmlvcd;
HFONT hOldFont; HFONT hOldFont;
DWORD cdmode; DWORD cdmode;
@ -3487,12 +3487,19 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc)
oldBkMode = GetBkMode(hdc); oldBkMode = GetBkMode(hdc);
infoPtr->clrTextBkDefault = GetBkColor(hdc); infoPtr->clrTextBkDefault = GetBkColor(hdc);
oldTextColor = GetTextColor(hdc); oldTextColor = GetTextColor(hdc);
oldClrTextBk = infoPtr->clrTextBk;
oldClrText = infoPtr->clrText;
GetClientRect(infoPtr->hwndSelf, &rcClient); GetClientRect(infoPtr->hwndSelf, &rcClient);
customdraw_fill(&nmlvcd, infoPtr, hdc, &rcClient, NULL); customdraw_fill(&nmlvcd, infoPtr, hdc, &rcClient, NULL);
cdmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd); cdmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd);
if (cdmode & CDRF_SKIPDEFAULT) goto enddraw; if (cdmode & CDRF_SKIPDEFAULT) goto enddraw;
/* Use these colors to draw the items */
infoPtr->clrTextBk = nmlvcd.clrTextBk;
infoPtr->clrText = nmlvcd.clrText;
/* nothing to draw */ /* nothing to draw */
if(infoPtr->nItemCount == 0) goto enddraw; if(infoPtr->nItemCount == 0) goto enddraw;
@ -3514,7 +3521,9 @@ enddraw:
if (cdmode & CDRF_NOTIFYPOSTPAINT) if (cdmode & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, CDDS_POSTPAINT, &nmlvcd); notify_customdraw(infoPtr, CDDS_POSTPAINT, &nmlvcd);
/* unselect objects */ infoPtr->clrTextBk = oldClrTextBk;
infoPtr->clrText = oldClrText;
SelectObject(hdc, hOldFont); SelectObject(hdc, hOldFont);
SetBkMode(hdc, oldBkMode); SetBkMode(hdc, oldBkMode);
SetBkColor(hdc, infoPtr->clrTextBkDefault); SetBkColor(hdc, infoPtr->clrTextBkDefault);