comctl32: Use correct font for themed headers.
This commit is contained in:
parent
9a3fdffe9d
commit
e7116725ff
|
@ -333,6 +333,7 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
|
||||||
INT oldBkMode;
|
INT oldBkMode;
|
||||||
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
|
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
|
||||||
NMCUSTOMDRAW nmcd;
|
NMCUSTOMDRAW nmcd;
|
||||||
|
int state = 0;
|
||||||
|
|
||||||
TRACE("DrawItem(iItem %d bHotTrack %d unicode flag %d)\n", iItem, bHotTrack, (infoPtr->nNotifyFormat == NFR_UNICODE));
|
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)
|
if (r.right - r.left == 0)
|
||||||
return phdi->rect.right;
|
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 */
|
/* Set the colors before sending NM_CUSTOMDRAW so that it can change them */
|
||||||
SetTextColor(hdc, (bHotTrack && !theme) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);
|
SetTextColor(hdc, (bHotTrack && !theme) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);
|
||||||
SetBkColor(hdc, comctl32_color.clr3dFace);
|
SetBkColor(hdc, comctl32_color.clr3dFace);
|
||||||
|
@ -418,8 +422,14 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
|
||||||
RECT textRect;
|
RECT textRect;
|
||||||
|
|
||||||
SetRectEmpty(&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;
|
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);
|
oldBkMode = SetBkMode(hdc, TRANSPARENT);
|
||||||
r.left = tx;
|
r.left = tx;
|
||||||
r.right = tx + tw;
|
r.right = tx + tw;
|
||||||
DrawTextW (hdc, phdi->pszText, -1,
|
if (theme) {
|
||||||
&r, DT_LEFT|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);
|
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)
|
if (oldBkMode != TRANSPARENT)
|
||||||
SetBkMode(hdc, oldBkMode);
|
SetBkMode(hdc, oldBkMode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue