Module: wine Branch: master Commit: 81050ccaffefef41d3776abec407290561935f40 URL: http://source.winehq.org/git/wine.git/?a=commit;h=81050ccaffefef41d3776abec4...
Author: Mikołaj Zalewski mikolaj@zalewski.pl Date: Sun Oct 8 23:43:33 2006 +0200
comctl32: toolbar: Create the tooltip control during WM_MOUSEMOVE so that the NM_TOOLTIPSCREATE is not sent too early.
---
dlls/comctl32/toolbar.c | 48 ++++++++++++++++++++++++++++------------------- 1 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index c25b01f..0de7a11 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -1941,6 +1941,31 @@ static void TOOLBAR_TooltipSetRect(TOOLB } }
+/* Creates the tooltip control */ +static void +TOOLBAR_TooltipCreateControl(TOOLBAR_INFO *infoPtr) +{ + int i; + NMTOOLTIPSCREATED nmttc; + + infoPtr->hwndToolTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, 0, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + infoPtr->hwndSelf, 0, 0, 0); + + if (!infoPtr->hwndToolTip) + return; + + /* Send NM_TOOLTIPSCREATED notification */ + nmttc.hwndToolTips = infoPtr->hwndToolTip; + TOOLBAR_SendNotify(&nmttc.hdr, infoPtr, NM_TOOLTIPSCREATED); + + for (i = 0; i < infoPtr->nNumButtons; i++) + { + TOOLBAR_TooltipAddTool(infoPtr, &infoPtr->buttons[i]); + TOOLBAR_TooltipSetRect(infoPtr, &infoPtr->buttons[i]); + } +} + /* keeps available button list box sorted by button id */ static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew) { @@ -5516,28 +5541,10 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam GetClientRect(hwnd, &infoPtr->client_rect); infoPtr->bUnicode = infoPtr->hwndNotify && (NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_REQUERY)); + infoPtr->hwndToolTip = NULL; /* if needed the tooltip control will be created after a WM_MOUSEMOVE */
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont); - - if (dwStyle & TBSTYLE_TOOLTIPS) { - /* Create tooltip control */ - infoPtr->hwndToolTip = - CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - hwnd, 0, 0, 0); - - /* Send NM_TOOLTIPSCREATED notification */ - if (infoPtr->hwndToolTip) - { - NMTOOLTIPSCREATED nmttc; - - nmttc.hwndToolTips = infoPtr->hwndToolTip; - - TOOLBAR_SendNotify (&nmttc.hdr, infoPtr, NM_TOOLTIPSCREATED); - } - }
OpenThemeData (hwnd, themeClass);
@@ -6192,6 +6199,9 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wPa INT nHit; TBUTTON_INFO *btnPtr;
+ if ((infoPtr->dwStyle & TBSTYLE_TOOLTIPS) && (infoPtr->hwndToolTip == NULL)) + TOOLBAR_TooltipCreateControl(infoPtr); + if ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)) { /* fill in the TRACKMOUSEEVENT struct */ trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);