Commit e7116725 authored by Mark Harmstone's avatar Mark Harmstone Committed by Alexandre Julliard

comctl32: Use correct font for themed headers.

parent 9a3fdffe
......@@ -333,6 +333,7 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
INT oldBkMode;
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
NMCUSTOMDRAW nmcd;
int state = 0;
TRACE("DrawItem(iItem %d bHotTrack %d unicode flag %d)\n", iItem, bHotTrack, (infoPtr->nNotifyFormat == NFR_UNICODE));
......@@ -340,6 +341,9 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
if (r.right - r.left == 0)
return phdi->rect.right;
if (theme)
state = (phdi->bDown) ? HIS_PRESSED : (bHotTrack ? HIS_HOT : HIS_NORMAL);
/* Set the colors before sending NM_CUSTOMDRAW so that it can change them */
SetTextColor(hdc, (bHotTrack && !theme) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);
SetBkColor(hdc, comctl32_color.clr3dFace);
......@@ -418,8 +422,14 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
RECT textRect;
SetRectEmpty(&textRect);
DrawTextW (hdc, phdi->pszText, -1,
&textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);
if (theme) {
GetThemeTextExtent(theme, hdc, HP_HEADERITEM, state, phdi->pszText, -1,
DT_LEFT|DT_VCENTER|DT_SINGLELINE, NULL, &textRect);
} else {
DrawTextW (hdc, phdi->pszText, -1,
&textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);
}
cw = textRect.right - textRect.left + 2 * infoPtr->iMargin;
}
......@@ -512,8 +522,14 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
oldBkMode = SetBkMode(hdc, TRANSPARENT);
r.left = tx;
r.right = tx + tw;
DrawTextW (hdc, phdi->pszText, -1,
&r, DT_LEFT|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);
if (theme) {
DrawThemeText(theme, hdc, HP_HEADERITEM, state, phdi->pszText,
-1, DT_LEFT|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE,
0, &r);
} else {
DrawTextW (hdc, phdi->pszText, -1,
&r, DT_LEFT|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);
}
if (oldBkMode != TRANSPARENT)
SetBkMode(hdc, oldBkMode);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment