Nikolay Sivov : comctl32: Fix font style when item is bold and hovered in track mode.
Alexandre Julliard
julliard at winehq.org
Tue Dec 11 14:41:15 CST 2012
Module: wine
Branch: master
Commit: fbd7f8813f0792616012875e714adb0b0381fcdd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fbd7f8813f0792616012875e714adb0b0381fcdd
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Dec 11 19:51:56 2012 +0300
comctl32: Fix font style when item is bold and hovered in track mode.
---
dlls/comctl32/treeview.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 57cb70c..22d7180 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -110,6 +110,7 @@ typedef struct tagTREEVIEW_INFO
HFONT hDefaultFont;
HFONT hBoldFont;
HFONT hUnderlineFont;
+ HFONT hBoldUnderlineFont;
HCURSOR hcurHand;
HWND hwndToolTip;
@@ -303,11 +304,22 @@ TREEVIEW_CreateUnderlineFont(HFONT hOrigFont)
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
TREEVIEW_FontForItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
{
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)
return infoPtr->hBoldFont;
return infoPtr->hFont;
@@ -1903,8 +1915,10 @@ TREEVIEW_SetFont(TREEVIEW_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
DeleteObject(infoPtr->hBoldFont);
DeleteObject(infoPtr->hUnderlineFont);
+ DeleteObject(infoPtr->hBoldUnderlineFont);
infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont);
+ infoPtr->hBoldUnderlineFont = TREEVIEW_CreateBoldUnderlineFont(infoPtr->hFont);
if (!infoPtr->bHeightSet)
infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
@@ -5059,6 +5073,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW(&lf);
infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont);
+ infoPtr->hBoldUnderlineFont = TREEVIEW_CreateBoldUnderlineFont(infoPtr->hFont);
infoPtr->hcurHand = LoadCursorW(NULL, (LPWSTR)IDC_HAND);
infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
@@ -5118,6 +5133,7 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr)
DeleteObject(infoPtr->hDefaultFont);
DeleteObject(infoPtr->hBoldFont);
DeleteObject(infoPtr->hUnderlineFont);
+ DeleteObject(infoPtr->hBoldUnderlineFont);
Free(infoPtr);
return 0;
More information about the wine-cvs
mailing list