comctl32: toolbar[1/8]: add support for WM_SETFONT

Mikołaj Zalewski mikolaj at zalewski.pl
Wed Nov 1 15:41:50 CST 2006


This will allow button size tests to be independent of whether Tahoma or 
MS Sans Seriff is the default
-------------- next part --------------
From cc0d40207b59771786a1682571b6e956e6242208 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Miko=C5=82aj_Zalewski?= <mikolaj at zalewski.pl>
Date: Wed, 1 Nov 2006 21:15:46 +0100
Subject: [PATCH] comctl32: toolbar: add support for WM_SETFONT

---
 dlls/comctl32/toolbar.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 9b96f90..1a6f603 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -5425,8 +5425,7 @@ TOOLBAR_Destroy (HWND hwnd, WPARAM wPara
 	TOOLBAR_DeleteImageList(&infoPtr->himlHot, &infoPtr->cimlHot);
 
     /* delete default font */
-    if (infoPtr->hFont)
-	DeleteObject (infoPtr->hDefaultFont);
+    DeleteObject (infoPtr->hDefaultFont);
         
     CloseThemeData (GetWindowTheme (hwnd));
 
@@ -6466,6 +6465,24 @@ TOOLBAR_SetFocus (HWND hwnd, WPARAM wPar
     return 0;
 }
 
+static LRESULT
+TOOLBAR_SetFont(HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
+    
+    TRACE("font=%p redraw=%ld\n", (HFONT)wParam, lParam);
+    
+    if (wParam == 0)
+        infoPtr->hFont = infoPtr->hDefaultFont;
+    else
+        infoPtr->hFont = (HFONT)wParam;
+
+    TOOLBAR_CalcToolbar(hwnd);
+
+    if (lParam)
+        InvalidateRect(hwnd, NULL, TRUE);
+    return 1;
+}
 
 static LRESULT
 TOOLBAR_SetRedraw (HWND hwnd, WPARAM wParam, LPARAM lParam)
@@ -6976,6 +6993,9 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
 	case WM_SETFOCUS:
 	    return TOOLBAR_SetFocus (hwnd, wParam);
 
+	case WM_SETFONT:
+            return TOOLBAR_SetFont(hwnd, wParam, lParam);
+
 	case WM_SETREDRAW:
 	    return TOOLBAR_SetRedraw (hwnd, wParam, lParam);
 
-- 
1.4.2.3


More information about the wine-patches mailing list