comctl32: toolbar: set maximum tooltip width

Oleg Krylov oleg.krylov at gmail.com
Wed Oct 18 08:06:06 CDT 2006


Native toolbar sets its tooltip control maxtipwidth. This also allows 
creation multiline tooltips. Value is based on current display dpi. 
Formula was obtained examining wine trace with native comctl32.dll

Changelog:
- Set maximum tooltip width
Author: Oleg Krylov
License: LGPL

-------------- next part --------------
>From 78a170f904d4e3f64931fc379bcaf46598a002ba Mon Sep 17 00:00:00 2001
From: Oleg Krylov <oleg.krylov at gmail.com>
Date: Wed, 18 Oct 2006 15:39:50 +0300
Subject: comctl32: toolbar: set maximum tooltip width

---
 dlls/comctl32/toolbar.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 806fa97..4276f7b 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -1949,6 +1949,7 @@ TOOLBAR_TooltipCreateControl(TOOLBAR_INF
 {
     int i;
     NMTOOLTIPSCREATED nmttc;
+    HDC hDC;
 
     infoPtr->hwndToolTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, WS_POPUP,
             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
@@ -1957,6 +1958,12 @@ TOOLBAR_TooltipCreateControl(TOOLBAR_INF
     if (!infoPtr->hwndToolTip)
         return;
 
+    /* Set maximum tooltip width */
+    hDC = GetDC (infoPtr->hwndToolTip);
+    SendMessageW (infoPtr->hwndToolTip, TTM_SETMAXTIPWIDTH, 0,
+                  MulDiv (GetDeviceCaps (hDC, LOGPIXELSX), 300, 72) );
+    ReleaseDC (infoPtr->hwndToolTip, hDC);
+
     /* Send NM_TOOLTIPSCREATED notification */
     nmttc.hwndToolTips = infoPtr->hwndToolTip;
     TOOLBAR_SendNotify(&nmttc.hdr, infoPtr, NM_TOOLTIPSCREATED);
-- 
1.4.2.3



More information about the wine-patches mailing list