comctl32: Fix font style when item is bold and hovered in track mode.
This commit is contained in:
parent
9336a3903c
commit
fbd7f8813f
@ -110,6 +110,7 @@ typedef struct tagTREEVIEW_INFO
|
|||||||
HFONT hDefaultFont;
|
HFONT hDefaultFont;
|
||||||
HFONT hBoldFont;
|
HFONT hBoldFont;
|
||||||
HFONT hUnderlineFont;
|
HFONT hUnderlineFont;
|
||||||
|
HFONT hBoldUnderlineFont;
|
||||||
HCURSOR hcurHand;
|
HCURSOR hcurHand;
|
||||||
HWND hwndToolTip;
|
HWND hwndToolTip;
|
||||||
|
|
||||||
@ -303,11 +304,22 @@ TREEVIEW_CreateUnderlineFont(HFONT hOrigFont)
|
|||||||
return CreateFontIndirectW(&font);
|
return CreateFontIndirectW(&font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HFONT
|
||||||
|
TREEVIEW_CreateBoldUnderlineFont(HFONT hfont)
|
||||||
|
{
|
||||||
|
LOGFONTW font;
|
||||||
|
|
||||||
|
GetObjectW(hfont, sizeof(font), &font);
|
||||||
|
font.lfWeight = FW_BOLD;
|
||||||
|
font.lfUnderline = TRUE;
|
||||||
|
return CreateFontIndirectW(&font);
|
||||||
|
}
|
||||||
|
|
||||||
static inline HFONT
|
static inline HFONT
|
||||||
TREEVIEW_FontForItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
|
TREEVIEW_FontForItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
|
||||||
{
|
{
|
||||||
if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (item == infoPtr->hotItem))
|
if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (item == infoPtr->hotItem))
|
||||||
return infoPtr->hUnderlineFont;
|
return item->state & TVIS_BOLD ? infoPtr->hBoldUnderlineFont : infoPtr->hUnderlineFont;
|
||||||
if (item->state & TVIS_BOLD)
|
if (item->state & TVIS_BOLD)
|
||||||
return infoPtr->hBoldFont;
|
return infoPtr->hBoldFont;
|
||||||
return infoPtr->hFont;
|
return infoPtr->hFont;
|
||||||
@ -1903,8 +1915,10 @@ TREEVIEW_SetFont(TREEVIEW_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
|
|||||||
|
|
||||||
DeleteObject(infoPtr->hBoldFont);
|
DeleteObject(infoPtr->hBoldFont);
|
||||||
DeleteObject(infoPtr->hUnderlineFont);
|
DeleteObject(infoPtr->hUnderlineFont);
|
||||||
|
DeleteObject(infoPtr->hBoldUnderlineFont);
|
||||||
infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
|
infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
|
||||||
infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont);
|
infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont);
|
||||||
|
infoPtr->hBoldUnderlineFont = TREEVIEW_CreateBoldUnderlineFont(infoPtr->hFont);
|
||||||
|
|
||||||
if (!infoPtr->bHeightSet)
|
if (!infoPtr->bHeightSet)
|
||||||
infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
|
infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
|
||||||
@ -5059,6 +5073,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
|
|||||||
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW(&lf);
|
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW(&lf);
|
||||||
infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
|
infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
|
||||||
infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont);
|
infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont);
|
||||||
|
infoPtr->hBoldUnderlineFont = TREEVIEW_CreateBoldUnderlineFont(infoPtr->hFont);
|
||||||
infoPtr->hcurHand = LoadCursorW(NULL, (LPWSTR)IDC_HAND);
|
infoPtr->hcurHand = LoadCursorW(NULL, (LPWSTR)IDC_HAND);
|
||||||
|
|
||||||
infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
|
infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
|
||||||
@ -5118,6 +5133,7 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr)
|
|||||||
DeleteObject(infoPtr->hDefaultFont);
|
DeleteObject(infoPtr->hDefaultFont);
|
||||||
DeleteObject(infoPtr->hBoldFont);
|
DeleteObject(infoPtr->hBoldFont);
|
||||||
DeleteObject(infoPtr->hUnderlineFont);
|
DeleteObject(infoPtr->hUnderlineFont);
|
||||||
|
DeleteObject(infoPtr->hBoldUnderlineFont);
|
||||||
Free(infoPtr);
|
Free(infoPtr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user