treeview: default font

Huw D M Davies h.davies1 at physics.ox.ac.uk
Thu Nov 18 08:56:38 CST 2004


        Huw Davies <huw at codeweavers.com>
        The default font for the treeview should be the icon title font.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/comctl32/treeview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.157
diff -u -p -r1.157 treeview.c
--- dlls/comctl32/treeview.c	6 Nov 2004 03:49:03 -0000	1.157
+++ dlls/comctl32/treeview.c	18 Nov 2004 15:52:15 -0000
@@ -130,6 +130,7 @@ typedef struct tagTREEVIEW_INFO
   COLORREF      clrLine;
   COLORREF      clrInsertMark;
   HFONT         hFont;
+  HFONT         hDefaultFont;
   HFONT         hBoldFont;
   HWND          hwndToolTip;
 
@@ -255,11 +256,11 @@ TREEVIEW_ValidItem(TREEVIEW_INFO *infoPt
 static HFONT
 TREEVIEW_CreateBoldFont(HFONT hOrigFont)
 {
-    LOGFONTA font;
+    LOGFONTW font;
 
-    GetObjectA(hOrigFont, sizeof(font), &font);
+    GetObjectW(hOrigFont, sizeof(font), &font);
     font.lfWeight = FW_BOLD;
-    return CreateFontIndirectA(&font);
+    return CreateFontIndirectW(&font);
 }
 
 static inline HFONT
@@ -1809,7 +1810,7 @@ TREEVIEW_SetFont(TREEVIEW_INFO *infoPtr,
 
     TRACE("%p %i\n", hFont, bRedraw);
 
-    infoPtr->hFont = hFont ? hFont : GetStockObject(SYSTEM_FONT);
+    infoPtr->hFont = hFont ? hFont : infoPtr->hDefaultFont;
 
     DeleteObject(infoPtr->hBoldFont);
     infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
@@ -4684,6 +4685,7 @@ TREEVIEW_Create(HWND hwnd, const CREATES
     static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' };
     RECT rcClient;
     TREEVIEW_INFO *infoPtr;
+    LOGFONTW lf;
 
     TRACE("wnd %p, style %lx\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE));
 
@@ -4749,7 +4751,8 @@ TREEVIEW_Create(HWND hwnd, const CREATES
 
     infoPtr->items = DPA_Create(16);
 
-    infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT);
+    SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
+    infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW(&lf);
     infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
 
     infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
@@ -4839,6 +4842,7 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr)
     /* Deassociate treeview from the window before doing anything drastic. */
     SetWindowLongPtrW(infoPtr->hwnd, 0, (DWORD_PTR)NULL);
 
+    DeleteObject(infoPtr->hDefaultFont);
     DeleteObject(infoPtr->hBoldFont);
     Free(infoPtr);
 



More information about the wine-patches mailing list