comctl32: Restore listview font on CDRF_NEWFONT.

This commit is contained in:
Maarten Lankhorst 2006-01-31 12:21:51 +01:00 committed by Alexandre Julliard
parent 61708da1c8
commit 15ca9ce672
1 changed files with 5 additions and 1 deletions

View File

@ -3677,6 +3677,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
NMLVCUSTOMDRAW nmlvcd; NMLVCUSTOMDRAW nmlvcd;
HIMAGELIST himl; HIMAGELIST himl;
LVITEMW lvItem; LVITEMW lvItem;
HFONT hOldFont;
TRACE("(hdc=%p, nItem=%d, nSubItem=%d, pos=%s)\n", hdc, nItem, nSubItem, wine_dbgstr_point(&pos)); TRACE("(hdc=%p, nItem=%d, nSubItem=%d, pos=%s)\n", hdc, nItem, nSubItem, wine_dbgstr_point(&pos));
@ -3699,7 +3700,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
/* now check if we need to update the focus rectangle */ /* now check if we need to update the focus rectangle */
lprcFocus = infoPtr->bFocus && (lvItem.state & LVIS_FOCUSED) ? &infoPtr->rcFocus : 0; lprcFocus = infoPtr->bFocus && (lvItem.state & LVIS_FOCUSED) ? &infoPtr->rcFocus : 0;
if (!lprcFocus) lvItem.state &= ~LVIS_FOCUSED; if (!lprcFocus) lvItem.state &= ~LVIS_FOCUSED;
LISTVIEW_GetItemMetrics(infoPtr, &lvItem, &rcBox, &rcState, &rcIcon, &rcLabel); LISTVIEW_GetItemMetrics(infoPtr, &lvItem, &rcBox, &rcState, &rcIcon, &rcLabel);
OffsetRect(&rcBox, pos.x, pos.y); OffsetRect(&rcBox, pos.x, pos.y);
@ -3713,6 +3714,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
/* fill in the custom draw structure */ /* fill in the custom draw structure */
customdraw_fill(&nmlvcd, infoPtr, hdc, &rcBox, &lvItem); customdraw_fill(&nmlvcd, infoPtr, hdc, &rcBox, &lvItem);
hOldFont = GetCurrentObject(hdc, OBJ_FONT);
if (nSubItem > 0) cdmode = infoPtr->cditemmode; if (nSubItem > 0) cdmode = infoPtr->cditemmode;
if (cdmode & CDRF_NOTIFYITEMDRAW) if (cdmode & CDRF_NOTIFYITEMDRAW)
cdsubitemmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd); cdsubitemmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd);
@ -3790,6 +3792,8 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
postpaint: postpaint:
if (cdsubitemmode & CDRF_NOTIFYPOSTPAINT) if (cdsubitemmode & CDRF_NOTIFYPOSTPAINT)
notify_postpaint(infoPtr, &nmlvcd); notify_postpaint(infoPtr, &nmlvcd);
if (cdsubitemmode & CDRF_NEWFONT)
SelectObject(hdc, hOldFont);
return TRUE; return TRUE;
} }