Commit 81050cca authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

comctl32: toolbar: Create the tooltip control during WM_MOUSEMOVE so that the…

comctl32: toolbar: Create the tooltip control during WM_MOUSEMOVE so that the NM_TOOLTIPSCREATE is not sent too early.
parent 7b899eab
...@@ -1941,6 +1941,31 @@ static void TOOLBAR_TooltipSetRect(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *button) ...@@ -1941,6 +1941,31 @@ static void TOOLBAR_TooltipSetRect(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *button)
} }
} }
/* 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 */ /* keeps available button list box sorted by button id */
static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew) static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew)
{ {
...@@ -5516,28 +5541,10 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5516,28 +5541,10 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
GetClientRect(hwnd, &infoPtr->client_rect); GetClientRect(hwnd, &infoPtr->client_rect);
infoPtr->bUnicode = infoPtr->hwndNotify && infoPtr->bUnicode = infoPtr->hwndNotify &&
(NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_REQUERY)); (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); SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont); 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); OpenThemeData (hwnd, themeClass);
...@@ -6192,6 +6199,9 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -6192,6 +6199,9 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT nHit; INT nHit;
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
if ((infoPtr->dwStyle & TBSTYLE_TOOLTIPS) && (infoPtr->hwndToolTip == NULL))
TOOLBAR_TooltipCreateControl(infoPtr);
if ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)) { if ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)) {
/* fill in the TRACKMOUSEEVENT struct */ /* fill in the TRACKMOUSEEVENT struct */
trackinfo.cbSize = sizeof(TRACKMOUSEEVENT); trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment