4 * Copyright 1998, 1999 Eric Kohl
5 * Copyright 2004 Robert Shearman
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * - Custom draw support.
27 * - Run tests using Waite Group Windows95 API Bible Volume 2.
28 * The second cdrom (chapter 3) contains executables activate.exe,
29 * curtool.exe, deltool.exe, enumtools.exe, getinfo.exe, getiptxt.exe,
30 * hittest.exe, needtext.exe, newrect.exe, updtext.exe and winfrpt.exe.
34 * One important point to remember is that tools don't necessarily get
35 * a WM_MOUSEMOVE once the cursor leaves the tool, an example is when
36 * a tool sets TTF_IDISHWND (i.e. an entire window is a tool) because
37 * here WM_MOUSEMOVEs only get sent when the cursor is inside the
38 * client area. Therefore the only reliable way to know that the
39 * cursor has left a tool is to keep a timer running and check the
40 * position every time it expires. This is the role of timer
44 * On entering a tool (detected in a relayed WM_MOUSEMOVE) we start
45 * ID_TIMERSHOW, if this times out and we're still in the tool we show
46 * the tip. On showing a tip we start both ID_TIMERPOP and
47 * ID_TIMERLEAVE. On hiding a tooltip we kill ID_TIMERPOP.
48 * ID_TIMERPOP is restarted on every relayed WM_MOUSEMOVE. If
49 * ID_TIMERPOP expires the tool is hidden and ID_TIMERPOP is killed.
50 * ID_TIMERLEAVE remains running - this is important as we need to
51 * determine when the cursor leaves the tool.
53 * When ID_TIMERLEAVE expires or on a relayed WM_MOUSEMOVE if we're
54 * still in the tool do nothing (apart from restart ID_TIMERPOP if
55 * this is a WM_MOUSEMOVE) (ID_TIMERLEAVE remains running). If we've
56 * left the tool and entered another one then hide the tip and start
57 * ID_TIMERSHOW with time ReshowTime and kill ID_TIMERLEAVE. If we're
58 * outside all tools hide the tip and kill ID_TIMERLEAVE. On Relayed
59 * mouse button messages hide the tip but leave ID_TIMERLEAVE running,
60 * this again will let us keep track of when the cursor leaves the
64 * infoPtr->nTool is the tool the mouse was on on the last relayed MM
65 * or timer expiry or -1 if the mouse was not on a tool.
67 * infoPtr->nCurrentTool is the tool for which the tip is currently
68 * displaying text for or -1 if the tip is not shown. Actually this
69 * will only ever be infoPtr-nTool or -1, so it could be changed to a
81 #include "wine/unicode.h"
87 #include "wine/debug.h"
89 WINE_DEFAULT_DEBUG_CHANNEL(tooltips);
91 static HICON hTooltipIcons[TTI_ERROR+1];
108 WCHAR szTipText[INFOTIPSIZE];
119 INT nTool; /* tool that mouse was on on last relayed mouse move */
133 #define ID_TIMERSHOW 1 /* show delay timer */
134 #define ID_TIMERPOP 2 /* auto pop timer */
135 #define ID_TIMERLEAVE 3 /* tool leave timer */
138 #define TOOLTIPS_GetInfoPtr(hWindow) ((TOOLTIPS_INFO *)GetWindowLongPtrW (hWindow, 0))
140 /* offsets from window edge to start of text */
141 #define NORMAL_TEXT_MARGIN 2
142 #define BALLOON_TEXT_MARGIN (NORMAL_TEXT_MARGIN+8)
143 /* value used for CreateRoundRectRgn that specifies how much
144 * each corner is curved */
145 #define BALLOON_ROUNDEDNESS 20
146 #define BALLOON_STEMHEIGHT 13
147 #define BALLOON_STEMWIDTH 10
148 #define BALLOON_STEMINDENT 20
150 #define BALLOON_ICON_TITLE_SPACING 8 /* horizontal spacing between icon and title */
151 #define BALLOON_TITLE_TEXT_SPACING 8 /* vertical spacing between icon/title and main text */
152 #define ICON_HEIGHT 16
153 #define ICON_WIDTH 16
156 TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef);
159 static inline UINT_PTR TOOLTIPS_GetTitleIconIndex(HICON hIcon)
162 for (i = 0; i <= TTI_ERROR; i++)
163 if (hTooltipIcons[i] == hIcon)
165 return (UINT_PTR)hIcon;
169 TOOLTIPS_InitSystemSettings (TOOLTIPS_INFO *infoPtr)
171 NONCLIENTMETRICSW nclm;
173 infoPtr->clrBk = GetSysColor (COLOR_INFOBK);
174 infoPtr->clrText = GetSysColor (COLOR_INFOTEXT);
176 DeleteObject (infoPtr->hFont);
177 nclm.cbSize = sizeof(nclm);
178 SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
179 infoPtr->hFont = CreateFontIndirectW (&nclm.lfStatusFont);
181 DeleteObject (infoPtr->hTitleFont);
182 nclm.lfStatusFont.lfWeight = FW_BOLD;
183 infoPtr->hTitleFont = CreateFontIndirectW (&nclm.lfStatusFont);
187 TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
189 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd);
194 UINT uFlags = DT_EXTERNALLEADING;
196 DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
198 if (infoPtr->nMaxTipWidth > -1)
199 uFlags |= DT_WORDBREAK;
200 if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX)
201 uFlags |= DT_NOPREFIX;
202 GetClientRect (hwnd, &rc);
204 hBrush = CreateSolidBrush(infoPtr->clrBk);
206 /* already drawn the background; don't need to draw it again
207 * when drawing text */
208 oldBkMode = SetBkMode (hdc, TRANSPARENT);
209 SetTextColor (hdc, infoPtr->clrText);
211 if (dwStyle & TTS_BALLOON)
213 /* create a region to store result into */
214 hRgn = CreateRectRgn(0, 0, 0, 0);
216 GetWindowRgn(hwnd, hRgn);
218 /* fill the background */
219 FillRgn(hdc, hRgn, hBrush);
220 DeleteObject(hBrush);
225 /* fill the background */
226 FillRect(hdc, &rc, hBrush);
227 DeleteObject(hBrush);
231 if ((dwStyle & TTS_BALLOON) || infoPtr->pszTitle)
233 /* calculate text rectangle */
234 rc.left += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left);
235 rc.top += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.top);
236 rc.right -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.right);
237 rc.bottom -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom);
238 if(infoPtr->bToolBelow) rc.top += BALLOON_STEMHEIGHT;
240 if (infoPtr->pszTitle)
242 RECT rcTitle = {rc.left, rc.top, rc.right, rc.bottom};
247 icon_present = infoPtr->hTitleIcon &&
248 DrawIconEx(hdc, rc.left, rc.top, infoPtr->hTitleIcon,
249 ICON_WIDTH, ICON_HEIGHT, 0, NULL, DI_NORMAL);
251 rcTitle.left += ICON_WIDTH + BALLOON_ICON_TITLE_SPACING;
253 rcTitle.bottom = rc.top + ICON_HEIGHT;
255 /* draw title text */
256 hOldFont = SelectObject (hdc, infoPtr->hTitleFont);
257 height = DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX);
258 SelectObject (hdc, hOldFont);
259 rc.top += height + BALLOON_TITLE_TEXT_SPACING;
264 /* calculate text rectangle */
265 rc.left += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.left);
266 rc.top += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.top);
267 rc.right -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.right);
268 rc.bottom -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.bottom);
272 hOldFont = SelectObject (hdc, infoPtr->hFont);
273 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
274 /* be polite and reset the things we changed in the dc */
275 SelectObject (hdc, hOldFont);
276 SetBkMode (hdc, oldBkMode);
278 if (dwStyle & TTS_BALLOON)
280 /* frame region because default window proc doesn't do it */
281 INT width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE);
282 INT height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE);
284 hBrush = GetSysColorBrush(COLOR_WINDOWFRAME);
285 FrameRgn(hdc, hRgn, hBrush, width, height);
292 static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr)
294 NMTTDISPINFOA ttnmdi;
296 /* fill NMHDR struct */
297 ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOA));
298 ttnmdi.hdr.hwndFrom = hwnd;
299 ttnmdi.hdr.idFrom = toolPtr->uId;
300 ttnmdi.hdr.code = TTN_GETDISPINFOA;
301 ttnmdi.lpszText = (LPSTR)&ttnmdi.szText;
302 ttnmdi.uFlags = toolPtr->uFlags;
303 ttnmdi.lParam = toolPtr->lParam;
305 TRACE("hdr.idFrom = %x\n", ttnmdi.hdr.idFrom);
306 SendMessageA(toolPtr->hwnd, WM_NOTIFY,
307 (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi);
309 if (HIWORD((UINT)ttnmdi.lpszText) == 0) {
310 LoadStringW(ttnmdi.hinst, (UINT)ttnmdi.lpszText,
311 infoPtr->szTipText, INFOTIPSIZE);
312 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
313 toolPtr->hinst = ttnmdi.hinst;
314 toolPtr->lpszText = (LPWSTR)ttnmdi.lpszText;
317 else if (ttnmdi.lpszText == 0) {
318 /* no text available */
319 infoPtr->szTipText[0] = '\0';
321 else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
322 INT max_len = (ttnmdi.lpszText == &ttnmdi.szText[0]) ?
323 sizeof(ttnmdi.szText)/sizeof(ttnmdi.szText[0]) : -1;
324 MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText, max_len,
325 infoPtr->szTipText, INFOTIPSIZE);
326 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
327 INT len = MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText,
330 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
331 MultiByteToWideChar(CP_ACP, 0, ttnmdi.lpszText, -1,
332 toolPtr->lpszText, len);
336 ERR("recursive text callback!\n");
337 infoPtr->szTipText[0] = '\0';
341 static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr)
343 NMTTDISPINFOW ttnmdi;
345 /* fill NMHDR struct */
346 ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOW));
347 ttnmdi.hdr.hwndFrom = hwnd;
348 ttnmdi.hdr.idFrom = toolPtr->uId;
349 ttnmdi.hdr.code = TTN_GETDISPINFOW;
350 ttnmdi.lpszText = (LPWSTR)&ttnmdi.szText;
351 ttnmdi.uFlags = toolPtr->uFlags;
352 ttnmdi.lParam = toolPtr->lParam;
354 TRACE("hdr.idFrom = %x\n", ttnmdi.hdr.idFrom);
355 SendMessageW(toolPtr->hwnd, WM_NOTIFY,
356 (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi);
358 if (HIWORD((UINT)ttnmdi.lpszText) == 0) {
359 LoadStringW(ttnmdi.hinst, (UINT)ttnmdi.lpszText,
360 infoPtr->szTipText, INFOTIPSIZE);
361 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
362 toolPtr->hinst = ttnmdi.hinst;
363 toolPtr->lpszText = ttnmdi.lpszText;
366 else if (ttnmdi.lpszText == 0) {
367 /* no text available */
368 infoPtr->szTipText[0] = '\0';
370 else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) {
371 INT max_len = (ttnmdi.lpszText == &ttnmdi.szText[0]) ?
372 sizeof(ttnmdi.szText)/sizeof(ttnmdi.szText[0]) : INFOTIPSIZE-1;
373 strncpyW(infoPtr->szTipText, ttnmdi.lpszText, max_len);
374 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
375 INT len = max(strlenW(ttnmdi.lpszText), max_len);
377 toolPtr->lpszText = Alloc ((len+1) * sizeof(WCHAR));
378 memcpy(toolPtr->lpszText, ttnmdi.lpszText, (len+1) * sizeof(WCHAR));
382 ERR("recursive text callback!\n");
383 infoPtr->szTipText[0] = '\0';
388 TOOLTIPS_GetTipText (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool)
390 TTTOOL_INFO *toolPtr = &infoPtr->tools[nTool];
392 if (HIWORD((UINT)toolPtr->lpszText) == 0 && toolPtr->hinst) {
393 /* load a resource */
394 TRACE("load res string %p %x\n",
395 toolPtr->hinst, (int)toolPtr->lpszText);
396 LoadStringW (toolPtr->hinst, (UINT)toolPtr->lpszText,
397 infoPtr->szTipText, INFOTIPSIZE);
399 else if (toolPtr->lpszText) {
400 if (toolPtr->lpszText == LPSTR_TEXTCALLBACKW) {
401 if (toolPtr->bNotifyUnicode)
402 TOOLTIPS_GetDispInfoW(hwnd, infoPtr, toolPtr);
404 TOOLTIPS_GetDispInfoA(hwnd, infoPtr, toolPtr);
407 /* the item is a usual (unicode) text */
408 lstrcpynW (infoPtr->szTipText, toolPtr->lpszText, INFOTIPSIZE);
412 /* no text available */
413 infoPtr->szTipText[0] = L'\0';
416 TRACE("%s\n", debugstr_w(infoPtr->szTipText));
421 TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
425 DWORD style = GetWindowLongW(hwnd, GWL_STYLE);
426 UINT uFlags = DT_EXTERNALLEADING | DT_CALCRECT;
427 RECT rc = {0, 0, 0, 0};
430 if (infoPtr->nMaxTipWidth > -1) {
431 rc.right = infoPtr->nMaxTipWidth;
432 uFlags |= DT_WORDBREAK;
434 if (style & TTS_NOPREFIX)
435 uFlags |= DT_NOPREFIX;
436 TRACE("%s\n", debugstr_w(infoPtr->szTipText));
439 if (infoPtr->pszTitle)
441 RECT rcTitle = {0, 0, 0, 0};
442 TRACE("title %s\n", debugstr_w(infoPtr->pszTitle));
443 if (infoPtr->hTitleIcon)
445 title.cx = ICON_WIDTH;
446 title.cy = ICON_HEIGHT;
448 if (title.cx != 0) title.cx += BALLOON_ICON_TITLE_SPACING;
449 hOldFont = SelectObject (hdc, infoPtr->hTitleFont);
450 DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT);
451 SelectObject (hdc, hOldFont);
452 title.cy = max(title.cy, rcTitle.bottom - rcTitle.top) + BALLOON_TITLE_TEXT_SPACING;
453 title.cx += (rcTitle.right - rcTitle.left);
455 hOldFont = SelectObject (hdc, infoPtr->hFont);
456 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
457 SelectObject (hdc, hOldFont);
458 ReleaseDC (hwnd, hdc);
460 if ((style & TTS_BALLOON) || infoPtr->pszTitle)
462 lpSize->cx = max(rc.right - rc.left, title.cx) + 2*BALLOON_TEXT_MARGIN +
463 infoPtr->rcMargin.left + infoPtr->rcMargin.right;
464 lpSize->cy = title.cy + rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN +
465 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top +
470 lpSize->cx = rc.right - rc.left + 2*NORMAL_TEXT_MARGIN +
471 infoPtr->rcMargin.left + infoPtr->rcMargin.right;
472 lpSize->cy = rc.bottom - rc.top + 2*NORMAL_TEXT_MARGIN +
473 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top;
479 TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
481 TTTOOL_INFO *toolPtr;
486 DWORD style = GetWindowLongW(hwnd, GWL_STYLE);
488 if (infoPtr->nTool == -1) {
489 TRACE("invalid tool (-1)!\n");
493 infoPtr->nCurrentTool = infoPtr->nTool;
495 TRACE("Show tooltip pre %d! (%p)\n", infoPtr->nTool, hwnd);
497 TOOLTIPS_GetTipText (hwnd, infoPtr, infoPtr->nCurrentTool);
499 if (infoPtr->szTipText[0] == L'\0') {
500 infoPtr->nCurrentTool = -1;
504 TRACE("Show tooltip %d!\n", infoPtr->nCurrentTool);
505 toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
508 hdr.idFrom = toolPtr->uId;
510 SendMessageA (toolPtr->hwnd, WM_NOTIFY,
511 (WPARAM)toolPtr->uId, (LPARAM)&hdr);
513 TRACE("%s\n", debugstr_w(infoPtr->szTipText));
515 TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
516 TRACE("size %ld x %ld\n", size.cx, size.cy);
518 if (toolPtr->uFlags & TTF_CENTERTIP) {
521 if (toolPtr->uFlags & TTF_IDISHWND)
522 GetWindowRect ((HWND)toolPtr->uId, &rc);
525 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
527 rect.left = (rc.left + rc.right - size.cx) / 2;
528 if (style & TTS_BALLOON)
530 ptfx = rc.left + ((rc.right - rc.left) / 2);
531 if(rect.top - size.cy >= 0)
534 infoPtr->bToolBelow = FALSE;
538 infoPtr->bToolBelow = TRUE;
541 rect.left = max(0, rect.left - BALLOON_STEMINDENT);
545 rect.top = rc.bottom + 2;
546 infoPtr->bToolBelow = TRUE;
550 GetCursorPos ((LPPOINT)&rect);
551 if (style & TTS_BALLOON)
554 if(rect.top - size.cy >= 0)
557 infoPtr->bToolBelow = FALSE;
561 infoPtr->bToolBelow = TRUE;
564 rect.left = max(0, rect.left - BALLOON_STEMINDENT);
569 infoPtr->bToolBelow = TRUE;
573 TRACE("pos %ld - %ld\n", rect.left, rect.top);
575 rect.right = rect.left + size.cx;
576 rect.bottom = rect.top + size.cy;
579 wndrect.right = GetSystemMetrics( SM_CXSCREEN );
580 if( rect.right > wndrect.right ) {
581 rect.left -= rect.right - wndrect.right + 2;
582 rect.right = wndrect.right - 2;
584 wndrect.bottom = GetSystemMetrics( SM_CYSCREEN );
585 if( rect.bottom > wndrect.bottom ) {
588 if (toolPtr->uFlags & TTF_IDISHWND)
589 GetWindowRect ((HWND)toolPtr->uId, &rc);
592 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
594 rect.bottom = rc.top - 2;
595 rect.top = rect.bottom - size.cy;
598 AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE),
599 FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE));
601 if (style & TTS_BALLOON)
609 if(infoPtr->bToolBelow)
613 pts[1].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
614 pts[1].y = BALLOON_STEMHEIGHT;
615 pts[2].x = pts[1].x + BALLOON_STEMWIDTH;
617 if(pts[2].x > (rect.right - rect.left) - BALLOON_STEMINDENT)
619 pts[2].x = (rect.right - rect.left) - BALLOON_STEMINDENT;
620 pts[1].x = pts[2].x - BALLOON_STEMWIDTH;
625 pts[0].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
626 pts[0].y = (rect.bottom - rect.top) - BALLOON_STEMHEIGHT;
627 pts[1].x = pts[0].x + BALLOON_STEMWIDTH;
630 pts[2].y = (rect.bottom - rect.top);
631 if(pts[1].x > (rect.right - rect.left) - BALLOON_STEMINDENT)
633 pts[1].x = (rect.right - rect.left) - BALLOON_STEMINDENT;
634 pts[0].x = pts[1].x - BALLOON_STEMWIDTH;
638 hrStem = CreatePolygonRgn(pts, sizeof(pts) / sizeof(pts[0]), ALTERNATE);
640 hRgn = CreateRoundRectRgn(0,
641 (infoPtr->bToolBelow ? BALLOON_STEMHEIGHT : 0),
642 rect.right - rect.left,
643 (infoPtr->bToolBelow ? rect.bottom - rect.top : rect.bottom - rect.top - BALLOON_STEMHEIGHT),
644 BALLOON_ROUNDEDNESS, BALLOON_ROUNDEDNESS);
646 CombineRgn(hRgn, hRgn, hrStem, RGN_OR);
647 DeleteObject(hrStem);
649 SetWindowRgn(hwnd, hRgn, FALSE);
650 /* we don't free the region handle as the system deletes it when
651 * it is no longer needed */
654 SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top,
655 rect.right - rect.left, rect.bottom - rect.top,
656 SWP_SHOWWINDOW | SWP_NOACTIVATE);
658 /* repaint the tooltip */
659 InvalidateRect(hwnd, NULL, TRUE);
662 SetTimer (hwnd, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
663 TRACE("timer 2 started!\n");
664 SetTimer (hwnd, ID_TIMERLEAVE, infoPtr->nReshowTime, 0);
665 TRACE("timer 3 started!\n");
670 TOOLTIPS_Hide (HWND hwnd, TOOLTIPS_INFO *infoPtr)
672 TTTOOL_INFO *toolPtr;
675 TRACE("Hide tooltip %d! (%p)\n", infoPtr->nCurrentTool, hwnd);
677 if (infoPtr->nCurrentTool == -1)
680 toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
681 KillTimer (hwnd, ID_TIMERPOP);
684 hdr.idFrom = toolPtr->uId;
686 SendMessageA (toolPtr->hwnd, WM_NOTIFY,
687 (WPARAM)toolPtr->uId, (LPARAM)&hdr);
689 infoPtr->nCurrentTool = -1;
691 SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
692 SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
697 TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr)
699 TTTOOL_INFO *toolPtr;
704 if (infoPtr->nTrackTool == -1) {
705 TRACE("invalid tracking tool (-1)!\n");
709 TRACE("show tracking tooltip pre %d!\n", infoPtr->nTrackTool);
711 TOOLTIPS_GetTipText (hwnd, infoPtr, infoPtr->nTrackTool);
713 if (infoPtr->szTipText[0] == L'\0') {
714 infoPtr->nTrackTool = -1;
718 TRACE("show tracking tooltip %d!\n", infoPtr->nTrackTool);
719 toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
722 hdr.idFrom = toolPtr->uId;
724 SendMessageA (toolPtr->hwnd, WM_NOTIFY,
725 (WPARAM)toolPtr->uId, (LPARAM)&hdr);
727 TRACE("%s\n", debugstr_w(infoPtr->szTipText));
729 TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
730 TRACE("size %ld x %ld\n", size.cx, size.cy);
732 if (toolPtr->uFlags & TTF_ABSOLUTE) {
733 rect.left = infoPtr->xTrackPos;
734 rect.top = infoPtr->yTrackPos;
736 if (toolPtr->uFlags & TTF_CENTERTIP) {
737 rect.left -= (size.cx / 2);
738 rect.top -= (size.cy / 2);
744 if (toolPtr->uFlags & TTF_IDISHWND)
745 GetWindowRect ((HWND)toolPtr->uId, &rcTool);
747 rcTool = toolPtr->rect;
748 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2);
751 GetCursorPos ((LPPOINT)&rect);
754 if (toolPtr->uFlags & TTF_CENTERTIP) {
755 rect.left -= (size.cx / 2);
756 rect.top -= (size.cy / 2);
759 /* smart placement */
760 if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) &&
761 (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom))
762 rect.left = rcTool.right;
765 TRACE("pos %ld - %ld\n", rect.left, rect.top);
767 rect.right = rect.left + size.cx;
768 rect.bottom = rect.top + size.cy;
770 AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE),
771 FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE));
773 if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON)
777 /* FIXME: need to add pointy bit using CreatePolyRgn & CombinRgn */
778 hRgn = CreateRoundRectRgn(0, 0, rect.right - rect.left, rect.bottom - rect.top, BALLOON_ROUNDEDNESS, BALLOON_ROUNDEDNESS);
780 SetWindowRgn(hwnd, hRgn, FALSE);
781 /* we don't free the region handle as the system deletes it when
782 * it is no longer needed */
785 SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top,
786 rect.right - rect.left, rect.bottom - rect.top,
787 SWP_SHOWWINDOW | SWP_NOACTIVATE );
789 InvalidateRect(hwnd, NULL, TRUE);
795 TOOLTIPS_TrackHide (HWND hwnd, TOOLTIPS_INFO *infoPtr)
797 TTTOOL_INFO *toolPtr;
800 TRACE("hide tracking tooltip %d\n", infoPtr->nTrackTool);
802 if (infoPtr->nTrackTool == -1)
805 toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
808 hdr.idFrom = toolPtr->uId;
810 SendMessageA (toolPtr->hwnd, WM_NOTIFY,
811 (WPARAM)toolPtr->uId, (LPARAM)&hdr);
813 SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
814 SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
819 TOOLTIPS_GetToolFromInfoA (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOA lpToolInfo)
821 TTTOOL_INFO *toolPtr;
824 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
825 toolPtr = &infoPtr->tools[nTool];
827 if (!(toolPtr->uFlags & TTF_IDISHWND) &&
828 (lpToolInfo->hwnd == toolPtr->hwnd) &&
829 (lpToolInfo->uId == toolPtr->uId))
833 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
834 toolPtr = &infoPtr->tools[nTool];
836 if ((toolPtr->uFlags & TTF_IDISHWND) &&
837 (lpToolInfo->uId == toolPtr->uId))
846 TOOLTIPS_GetToolFromInfoW (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOW lpToolInfo)
848 TTTOOL_INFO *toolPtr;
851 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
852 toolPtr = &infoPtr->tools[nTool];
854 if (!(toolPtr->uFlags & TTF_IDISHWND) &&
855 (lpToolInfo->hwnd == toolPtr->hwnd) &&
856 (lpToolInfo->uId == toolPtr->uId))
860 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
861 toolPtr = &infoPtr->tools[nTool];
863 if ((toolPtr->uFlags & TTF_IDISHWND) &&
864 (lpToolInfo->uId == toolPtr->uId))
873 TOOLTIPS_GetToolFromPoint (TOOLTIPS_INFO *infoPtr, HWND hwnd, LPPOINT lpPt)
875 TTTOOL_INFO *toolPtr;
878 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
879 toolPtr = &infoPtr->tools[nTool];
881 if (!(toolPtr->uFlags & TTF_IDISHWND)) {
882 if (hwnd != toolPtr->hwnd)
884 if (!PtInRect (&toolPtr->rect, *lpPt))
890 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
891 toolPtr = &infoPtr->tools[nTool];
893 if (toolPtr->uFlags & TTF_IDISHWND) {
894 if ((HWND)toolPtr->uId == hwnd)
904 TOOLTIPS_IsWindowActive (HWND hwnd)
906 HWND hwndActive = GetActiveWindow ();
909 if (hwndActive == hwnd)
911 return IsChild (hwndActive, hwnd);
916 TOOLTIPS_CheckTool (HWND hwnd, BOOL bShowTest)
918 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
924 hwndTool = (HWND)SendMessageA (hwnd, TTM_WINDOWFROMPOINT, 0, (LPARAM)&pt);
928 ScreenToClient (hwndTool, &pt);
929 nTool = TOOLTIPS_GetToolFromPoint (infoPtr, hwndTool, &pt);
933 if (!(GetWindowLongA (hwnd, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest) {
934 if (!TOOLTIPS_IsWindowActive (GetWindow (hwnd, GW_OWNER)))
938 TRACE("tool %d\n", nTool);
945 TOOLTIPS_Activate (HWND hwnd, WPARAM wParam, LPARAM lParam)
947 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
949 infoPtr->bActive = (BOOL)wParam;
951 if (infoPtr->bActive)
952 TRACE("activate!\n");
954 if (!(infoPtr->bActive) && (infoPtr->nCurrentTool != -1))
955 TOOLTIPS_Hide (hwnd, infoPtr);
962 TOOLTIPS_AddToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
964 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
965 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
966 TTTOOL_INFO *toolPtr;
969 if (lpToolInfo == NULL)
971 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
974 TRACE("add tool (%p) %p %d%s!\n",
975 hwnd, lpToolInfo->hwnd, lpToolInfo->uId,
976 (lpToolInfo->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
978 if (infoPtr->uNumTools == 0) {
979 infoPtr->tools = Alloc (sizeof(TTTOOL_INFO));
980 toolPtr = infoPtr->tools;
983 TTTOOL_INFO *oldTools = infoPtr->tools;
985 Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools + 1));
986 memcpy (infoPtr->tools, oldTools,
987 infoPtr->uNumTools * sizeof(TTTOOL_INFO));
989 toolPtr = &infoPtr->tools[infoPtr->uNumTools];
992 infoPtr->uNumTools++;
995 toolPtr->uFlags = lpToolInfo->uFlags;
996 toolPtr->hwnd = lpToolInfo->hwnd;
997 toolPtr->uId = lpToolInfo->uId;
998 toolPtr->rect = lpToolInfo->rect;
999 toolPtr->hinst = lpToolInfo->hinst;
1001 if (HIWORD(lpToolInfo->lpszText) == 0) {
1002 TRACE("add string id %x!\n", (int)lpToolInfo->lpszText);
1003 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText;
1005 else if (lpToolInfo->lpszText) {
1006 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) {
1007 TRACE("add CALLBACK!\n");
1008 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
1011 INT len = MultiByteToWideChar(CP_ACP, 0, lpToolInfo->lpszText, -1,
1013 TRACE("add text \"%s\"!\n", lpToolInfo->lpszText);
1014 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
1015 MultiByteToWideChar(CP_ACP, 0, lpToolInfo->lpszText, -1,
1016 toolPtr->lpszText, len);
1020 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA))
1021 toolPtr->lParam = lpToolInfo->lParam;
1023 /* install subclassing hook */
1024 if (toolPtr->uFlags & TTF_SUBCLASS) {
1025 if (toolPtr->uFlags & TTF_IDISHWND) {
1026 SetWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1,
1030 SetWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1,
1033 TRACE("subclassing installed!\n");
1036 nResult = (INT) SendMessageA (toolPtr->hwnd, WM_NOTIFYFORMAT,
1037 (WPARAM)hwnd, (LPARAM)NF_QUERY);
1038 if (nResult == NFR_ANSI) {
1039 toolPtr->bNotifyUnicode = FALSE;
1040 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
1041 } else if (nResult == NFR_UNICODE) {
1042 toolPtr->bNotifyUnicode = TRUE;
1043 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
1045 TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
1053 TOOLTIPS_AddToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1055 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1056 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
1057 TTTOOL_INFO *toolPtr;
1060 if (lpToolInfo == NULL)
1062 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1065 TRACE("add tool (%p) %p %d%s!\n",
1066 hwnd, lpToolInfo->hwnd, lpToolInfo->uId,
1067 (lpToolInfo->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
1069 if (infoPtr->uNumTools == 0) {
1070 infoPtr->tools = Alloc (sizeof(TTTOOL_INFO));
1071 toolPtr = infoPtr->tools;
1074 TTTOOL_INFO *oldTools = infoPtr->tools;
1076 Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools + 1));
1077 memcpy (infoPtr->tools, oldTools,
1078 infoPtr->uNumTools * sizeof(TTTOOL_INFO));
1080 toolPtr = &infoPtr->tools[infoPtr->uNumTools];
1083 infoPtr->uNumTools++;
1085 /* copy tool data */
1086 toolPtr->uFlags = lpToolInfo->uFlags;
1087 toolPtr->hwnd = lpToolInfo->hwnd;
1088 toolPtr->uId = lpToolInfo->uId;
1089 toolPtr->rect = lpToolInfo->rect;
1090 toolPtr->hinst = lpToolInfo->hinst;
1092 if (HIWORD(lpToolInfo->lpszText) == 0) {
1093 TRACE("add string id %x!\n", (int)lpToolInfo->lpszText);
1094 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText;
1096 else if (lpToolInfo->lpszText) {
1097 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) {
1098 TRACE("add CALLBACK!\n");
1099 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
1102 INT len = lstrlenW (lpToolInfo->lpszText);
1103 TRACE("add text %s!\n",
1104 debugstr_w(lpToolInfo->lpszText));
1105 toolPtr->lpszText = Alloc ((len + 1)*sizeof(WCHAR));
1106 strcpyW (toolPtr->lpszText, lpToolInfo->lpszText);
1110 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW))
1111 toolPtr->lParam = lpToolInfo->lParam;
1113 /* install subclassing hook */
1114 if (toolPtr->uFlags & TTF_SUBCLASS) {
1115 if (toolPtr->uFlags & TTF_IDISHWND) {
1116 SetWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1,
1120 SetWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1,
1123 TRACE("subclassing installed!\n");
1126 nResult = (INT) SendMessageA (toolPtr->hwnd, WM_NOTIFYFORMAT,
1127 (WPARAM)hwnd, (LPARAM)NF_QUERY);
1128 if (nResult == NFR_ANSI) {
1129 toolPtr->bNotifyUnicode = FALSE;
1130 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
1131 } else if (nResult == NFR_UNICODE) {
1132 toolPtr->bNotifyUnicode = TRUE;
1133 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
1135 TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
1142 static void TOOLTIPS_DelToolCommon (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool)
1144 TTTOOL_INFO *toolPtr;
1146 TRACE("tool %d\n", nTool);
1151 /* make sure the tooltip has disappeared before deleting it */
1152 TOOLTIPS_Hide(hwnd, infoPtr);
1154 /* delete text string */
1155 toolPtr = &infoPtr->tools[nTool];
1156 if (toolPtr->lpszText) {
1157 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
1158 (HIWORD((INT)toolPtr->lpszText) != 0) )
1159 Free (toolPtr->lpszText);
1162 /* remove subclassing */
1163 if (toolPtr->uFlags & TTF_SUBCLASS) {
1164 if (toolPtr->uFlags & TTF_IDISHWND) {
1165 RemoveWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1);
1168 RemoveWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1);
1172 /* delete tool from tool list */
1173 if (infoPtr->uNumTools == 1) {
1174 Free (infoPtr->tools);
1175 infoPtr->tools = NULL;
1178 TTTOOL_INFO *oldTools = infoPtr->tools;
1180 Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools - 1));
1183 memcpy (&infoPtr->tools[0], &oldTools[0],
1184 nTool * sizeof(TTTOOL_INFO));
1186 if (nTool < infoPtr->uNumTools - 1)
1187 memcpy (&infoPtr->tools[nTool], &oldTools[nTool + 1],
1188 (infoPtr->uNumTools - nTool - 1) * sizeof(TTTOOL_INFO));
1193 /* update any indices affected by delete */
1195 /* destroying tool that mouse was on on last relayed mouse move */
1196 if (infoPtr->nTool == nTool)
1197 /* -1 means no current tool (0 means first tool) */
1198 infoPtr->nTool = -1;
1199 else if (infoPtr->nTool > nTool)
1202 if (infoPtr->nTrackTool == nTool)
1203 /* -1 means no current tool (0 means first tool) */
1204 infoPtr->nTrackTool = -1;
1205 else if (infoPtr->nTrackTool > nTool)
1206 infoPtr->nTrackTool--;
1208 if (infoPtr->nCurrentTool == nTool)
1209 /* -1 means no current tool (0 means first tool) */
1210 infoPtr->nCurrentTool = -1;
1211 else if (infoPtr->nCurrentTool > nTool)
1212 infoPtr->nCurrentTool--;
1214 infoPtr->uNumTools--;
1218 TOOLTIPS_DelToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1220 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1221 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
1224 if (lpToolInfo == NULL)
1226 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
1228 if (infoPtr->uNumTools == 0)
1231 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
1233 TOOLTIPS_DelToolCommon (hwnd, infoPtr, nTool);
1240 TOOLTIPS_DelToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1242 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1243 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
1246 if (lpToolInfo == NULL)
1248 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1250 if (infoPtr->uNumTools == 0)
1253 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo);
1255 TOOLTIPS_DelToolCommon (hwnd, infoPtr, nTool);
1262 TOOLTIPS_EnumToolsA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1264 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1265 UINT uIndex = (UINT)wParam;
1266 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
1267 TTTOOL_INFO *toolPtr;
1269 if (lpToolInfo == NULL)
1271 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
1273 if (uIndex >= infoPtr->uNumTools)
1276 TRACE("index=%u\n", uIndex);
1278 toolPtr = &infoPtr->tools[uIndex];
1280 /* copy tool data */
1281 lpToolInfo->uFlags = toolPtr->uFlags;
1282 lpToolInfo->hwnd = toolPtr->hwnd;
1283 lpToolInfo->uId = toolPtr->uId;
1284 lpToolInfo->rect = toolPtr->rect;
1285 lpToolInfo->hinst = toolPtr->hinst;
1286 /* lpToolInfo->lpszText = toolPtr->lpszText; */
1287 lpToolInfo->lpszText = NULL; /* FIXME */
1289 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA))
1290 lpToolInfo->lParam = toolPtr->lParam;
1297 TOOLTIPS_EnumToolsW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1299 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1300 UINT uIndex = (UINT)wParam;
1301 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
1302 TTTOOL_INFO *toolPtr;
1304 if (lpToolInfo == NULL)
1306 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1308 if (uIndex >= infoPtr->uNumTools)
1311 TRACE("index=%u\n", uIndex);
1313 toolPtr = &infoPtr->tools[uIndex];
1315 /* copy tool data */
1316 lpToolInfo->uFlags = toolPtr->uFlags;
1317 lpToolInfo->hwnd = toolPtr->hwnd;
1318 lpToolInfo->uId = toolPtr->uId;
1319 lpToolInfo->rect = toolPtr->rect;
1320 lpToolInfo->hinst = toolPtr->hinst;
1321 /* lpToolInfo->lpszText = toolPtr->lpszText; */
1322 lpToolInfo->lpszText = NULL; /* FIXME */
1324 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW))
1325 lpToolInfo->lParam = toolPtr->lParam;
1331 TOOLTIPS_GetBubbleSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
1333 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1334 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
1338 if (lpToolInfo == NULL)
1340 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1343 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo);
1344 if (nTool == -1) return 0;
1346 TRACE("tool %d\n", nTool);
1348 TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
1349 TRACE("size %ld x %ld\n", size.cx, size.cy);
1351 return MAKELRESULT(size.cx, size.cy);
1355 TOOLTIPS_GetCurrentToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1357 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1358 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
1359 TTTOOL_INFO *toolPtr;
1361 if (lpToolInfo == NULL)
1363 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
1367 if (infoPtr->nCurrentTool > -1) {
1368 toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
1370 /* copy tool data */
1371 lpToolInfo->uFlags = toolPtr->uFlags;
1372 lpToolInfo->rect = toolPtr->rect;
1373 lpToolInfo->hinst = toolPtr->hinst;
1374 /* lpToolInfo->lpszText = toolPtr->lpszText; */
1375 lpToolInfo->lpszText = NULL; /* FIXME */
1377 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA))
1378 lpToolInfo->lParam = toolPtr->lParam;
1386 return (infoPtr->nCurrentTool != -1);
1393 TOOLTIPS_GetCurrentToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1395 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1396 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
1397 TTTOOL_INFO *toolPtr;
1399 if (lpToolInfo == NULL)
1401 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1405 if (infoPtr->nCurrentTool > -1) {
1406 toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
1408 /* copy tool data */
1409 lpToolInfo->uFlags = toolPtr->uFlags;
1410 lpToolInfo->rect = toolPtr->rect;
1411 lpToolInfo->hinst = toolPtr->hinst;
1412 /* lpToolInfo->lpszText = toolPtr->lpszText; */
1413 lpToolInfo->lpszText = NULL; /* FIXME */
1415 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW))
1416 lpToolInfo->lParam = toolPtr->lParam;
1424 return (infoPtr->nCurrentTool != -1);
1431 TOOLTIPS_GetDelayTime (HWND hwnd, WPARAM wParam, LPARAM lParam)
1433 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1437 return infoPtr->nReshowTime;
1440 return infoPtr->nAutoPopTime;
1443 case TTDT_AUTOMATIC: /* Apparently TTDT_AUTOMATIC returns TTDT_INITIAL */
1444 return infoPtr->nInitialTime;
1447 WARN("Invalid wParam %x\n", wParam);
1456 TOOLTIPS_GetMargin (HWND hwnd, WPARAM wParam, LPARAM lParam)
1458 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1459 LPRECT lpRect = (LPRECT)lParam;
1461 lpRect->left = infoPtr->rcMargin.left;
1462 lpRect->right = infoPtr->rcMargin.right;
1463 lpRect->bottom = infoPtr->rcMargin.bottom;
1464 lpRect->top = infoPtr->rcMargin.top;
1470 inline static LRESULT
1471 TOOLTIPS_GetMaxTipWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
1473 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1475 return infoPtr->nMaxTipWidth;
1480 TOOLTIPS_GetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1482 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1483 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
1486 if (lpToolInfo == NULL)
1488 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
1491 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
1492 if (nTool == -1) return 0;
1494 /* NB this API is broken, there is no way for the app to determine
1495 what size buffer it requires nor a way to specify how long the
1496 one it supplies is. We'll assume it's upto INFOTIPSIZE */
1498 WideCharToMultiByte(CP_ACP, 0, infoPtr->tools[nTool].lpszText, -1,
1499 lpToolInfo->lpszText, INFOTIPSIZE, NULL, NULL);
1506 TOOLTIPS_GetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1508 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1509 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
1512 if (lpToolInfo == NULL)
1514 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1517 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo);
1518 if (nTool == -1) return 0;
1520 strcpyW (lpToolInfo->lpszText, infoPtr->tools[nTool].lpszText);
1526 inline static LRESULT
1527 TOOLTIPS_GetTipBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
1529 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1530 return infoPtr->clrBk;
1534 inline static LRESULT
1535 TOOLTIPS_GetTipTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
1537 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1538 return infoPtr->clrText;
1542 inline static LRESULT
1543 TOOLTIPS_GetToolCount (HWND hwnd, WPARAM wParam, LPARAM lParam)
1545 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1546 return infoPtr->uNumTools;
1551 TOOLTIPS_GetToolInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1553 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1554 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
1555 TTTOOL_INFO *toolPtr;
1558 if (lpToolInfo == NULL)
1560 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
1562 if (infoPtr->uNumTools == 0)
1565 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
1569 TRACE("tool %d\n", nTool);
1571 toolPtr = &infoPtr->tools[nTool];
1573 /* copy tool data */
1574 lpToolInfo->uFlags = toolPtr->uFlags;
1575 lpToolInfo->rect = toolPtr->rect;
1576 lpToolInfo->hinst = toolPtr->hinst;
1577 /* lpToolInfo->lpszText = toolPtr->lpszText; */
1578 lpToolInfo->lpszText = NULL; /* FIXME */
1580 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA))
1581 lpToolInfo->lParam = toolPtr->lParam;
1588 TOOLTIPS_GetToolInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1590 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1591 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
1592 TTTOOL_INFO *toolPtr;
1595 if (lpToolInfo == NULL)
1597 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1599 if (infoPtr->uNumTools == 0)
1602 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo);
1606 TRACE("tool %d\n", nTool);
1608 toolPtr = &infoPtr->tools[nTool];
1610 /* copy tool data */
1611 lpToolInfo->uFlags = toolPtr->uFlags;
1612 lpToolInfo->rect = toolPtr->rect;
1613 lpToolInfo->hinst = toolPtr->hinst;
1614 /* lpToolInfo->lpszText = toolPtr->lpszText; */
1615 lpToolInfo->lpszText = NULL; /* FIXME */
1617 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW))
1618 lpToolInfo->lParam = toolPtr->lParam;
1625 TOOLTIPS_HitTestA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1627 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1628 LPTTHITTESTINFOA lptthit = (LPTTHITTESTINFOA)lParam;
1629 TTTOOL_INFO *toolPtr;
1635 nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lptthit->hwnd, &lptthit->pt);
1639 TRACE("tool %d!\n", nTool);
1641 /* copy tool data */
1642 if (lptthit->ti.cbSize >= sizeof(TTTOOLINFOA)) {
1643 toolPtr = &infoPtr->tools[nTool];
1645 lptthit->ti.uFlags = toolPtr->uFlags;
1646 lptthit->ti.hwnd = toolPtr->hwnd;
1647 lptthit->ti.uId = toolPtr->uId;
1648 lptthit->ti.rect = toolPtr->rect;
1649 lptthit->ti.hinst = toolPtr->hinst;
1650 /* lptthit->ti.lpszText = toolPtr->lpszText; */
1651 lptthit->ti.lpszText = NULL; /* FIXME */
1652 lptthit->ti.lParam = toolPtr->lParam;
1660 TOOLTIPS_HitTestW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1662 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1663 LPTTHITTESTINFOW lptthit = (LPTTHITTESTINFOW)lParam;
1664 TTTOOL_INFO *toolPtr;
1670 nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lptthit->hwnd, &lptthit->pt);
1674 TRACE("tool %d!\n", nTool);
1676 /* copy tool data */
1677 if (lptthit->ti.cbSize >= sizeof(TTTOOLINFOW)) {
1678 toolPtr = &infoPtr->tools[nTool];
1680 lptthit->ti.uFlags = toolPtr->uFlags;
1681 lptthit->ti.hwnd = toolPtr->hwnd;
1682 lptthit->ti.uId = toolPtr->uId;
1683 lptthit->ti.rect = toolPtr->rect;
1684 lptthit->ti.hinst = toolPtr->hinst;
1685 /* lptthit->ti.lpszText = toolPtr->lpszText; */
1686 lptthit->ti.lpszText = NULL; /* FIXME */
1687 lptthit->ti.lParam = toolPtr->lParam;
1695 TOOLTIPS_NewToolRectA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1697 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1698 LPTTTOOLINFOA lpti = (LPTTTOOLINFOA)lParam;
1703 if (lpti->cbSize < TTTOOLINFOA_V1_SIZE)
1706 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpti);
1708 TRACE("nTool = %d, rect = %s\n", nTool, wine_dbgstr_rect(&lpti->rect));
1710 if (nTool == -1) return 0;
1712 infoPtr->tools[nTool].rect = lpti->rect;
1719 TOOLTIPS_NewToolRectW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1721 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1722 LPTTTOOLINFOW lpti = (LPTTTOOLINFOW)lParam;
1727 if (lpti->cbSize < TTTOOLINFOW_V1_SIZE)
1730 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpti);
1732 TRACE("nTool = %d, rect = %s\n", nTool, wine_dbgstr_rect(&lpti->rect));
1734 if (nTool == -1) return 0;
1736 infoPtr->tools[nTool].rect = lpti->rect;
1742 inline static LRESULT
1743 TOOLTIPS_Pop (HWND hwnd, WPARAM wParam, LPARAM lParam)
1745 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1746 TOOLTIPS_Hide (hwnd, infoPtr);
1753 TOOLTIPS_RelayEvent (HWND hwnd, WPARAM wParam, LPARAM lParam)
1755 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1756 LPMSG lpMsg = (LPMSG)lParam;
1761 ERR("lpMsg == NULL!\n");
1765 switch (lpMsg->message) {
1766 case WM_LBUTTONDOWN:
1768 case WM_MBUTTONDOWN:
1770 case WM_RBUTTONDOWN:
1772 TOOLTIPS_Hide (hwnd, infoPtr);
1776 pt.x = LOWORD(lpMsg->lParam);
1777 pt.y = HIWORD(lpMsg->lParam);
1778 nOldTool = infoPtr->nTool;
1779 infoPtr->nTool = TOOLTIPS_GetToolFromPoint(infoPtr, lpMsg->hwnd,
1781 TRACE("tool (%p) %d %d %d\n", hwnd, nOldTool,
1782 infoPtr->nTool, infoPtr->nCurrentTool);
1783 TRACE("WM_MOUSEMOVE (%p %ld %ld)\n", hwnd, pt.x, pt.y);
1785 if (infoPtr->nTool != nOldTool) {
1786 if(infoPtr->nTool == -1) { /* Moved out of all tools */
1787 TOOLTIPS_Hide(hwnd, infoPtr);
1788 KillTimer(hwnd, ID_TIMERLEAVE);
1789 } else if (nOldTool == -1) { /* Moved from outside */
1790 if(infoPtr->bActive) {
1791 SetTimer(hwnd, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
1792 TRACE("timer 1 started!\n");
1794 } else { /* Moved from one to another */
1795 TOOLTIPS_Hide (hwnd, infoPtr);
1796 KillTimer(hwnd, ID_TIMERLEAVE);
1797 if(infoPtr->bActive) {
1798 SetTimer (hwnd, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
1799 TRACE("timer 1 started!\n");
1802 } else if(infoPtr->nCurrentTool != -1) { /* restart autopop */
1803 KillTimer(hwnd, ID_TIMERPOP);
1804 SetTimer(hwnd, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
1805 TRACE("timer 2 restarted\n");
1806 } else if(infoPtr->nTool != -1 && infoPtr->bActive) {
1807 /* previous show attempt didn't result in tooltip so try again */
1808 SetTimer(hwnd, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
1809 TRACE("timer 1 started!\n");
1819 TOOLTIPS_SetDelayTime (HWND hwnd, WPARAM wParam, LPARAM lParam)
1821 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1822 INT nTime = (INT)LOWORD(lParam);
1825 case TTDT_AUTOMATIC:
1827 nTime = GetDoubleClickTime();
1828 infoPtr->nReshowTime = nTime / 5;
1829 infoPtr->nAutoPopTime = nTime * 10;
1830 infoPtr->nInitialTime = nTime;
1835 nTime = GetDoubleClickTime() / 5;
1836 infoPtr->nReshowTime = nTime;
1841 nTime = GetDoubleClickTime() * 10;
1842 infoPtr->nAutoPopTime = nTime;
1847 nTime = GetDoubleClickTime();
1848 infoPtr->nInitialTime = nTime;
1852 WARN("Invalid wParam %x\n", wParam);
1861 TOOLTIPS_SetMargin (HWND hwnd, WPARAM wParam, LPARAM lParam)
1863 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1864 LPRECT lpRect = (LPRECT)lParam;
1866 infoPtr->rcMargin.left = lpRect->left;
1867 infoPtr->rcMargin.right = lpRect->right;
1868 infoPtr->rcMargin.bottom = lpRect->bottom;
1869 infoPtr->rcMargin.top = lpRect->top;
1875 inline static LRESULT
1876 TOOLTIPS_SetMaxTipWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
1878 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1879 INT nTemp = infoPtr->nMaxTipWidth;
1881 infoPtr->nMaxTipWidth = (INT)lParam;
1887 inline static LRESULT
1888 TOOLTIPS_SetTipBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
1890 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1892 infoPtr->clrBk = (COLORREF)wParam;
1898 inline static LRESULT
1899 TOOLTIPS_SetTipTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
1901 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1903 infoPtr->clrText = (COLORREF)wParam;
1910 TOOLTIPS_SetTitleA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1912 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1913 LPCSTR pszTitle = (LPCSTR)lParam;
1914 UINT uTitleIcon = (UINT)wParam;
1917 TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, pszTitle, (void*)uTitleIcon);
1919 size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, NULL, 0);
1920 infoPtr->pszTitle = Alloc(size);
1921 if (!infoPtr->pszTitle)
1923 MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
1924 if (uTitleIcon <= TTI_ERROR)
1925 infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
1927 infoPtr->hTitleIcon = CopyIcon((HICON)wParam);
1934 TOOLTIPS_SetTitleW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1936 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1937 LPCWSTR pszTitle = (LPCWSTR)lParam;
1938 UINT uTitleIcon = (UINT)wParam;
1941 TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_w(pszTitle), (void*)uTitleIcon);
1943 size = (strlenW(pszTitle)+1)*sizeof(WCHAR);
1944 infoPtr->pszTitle = Alloc(size);
1945 if (!infoPtr->pszTitle)
1947 memcpy(infoPtr->pszTitle, pszTitle, size);
1948 if (uTitleIcon <= TTI_ERROR)
1949 infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
1951 infoPtr->hTitleIcon = CopyIcon((HICON)wParam);
1953 TRACE("icon = %p\n", infoPtr->hTitleIcon);
1960 TOOLTIPS_SetToolInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1962 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
1963 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
1964 TTTOOL_INFO *toolPtr;
1967 if (lpToolInfo == NULL)
1969 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
1972 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
1973 if (nTool == -1) return 0;
1975 TRACE("tool %d\n", nTool);
1977 toolPtr = &infoPtr->tools[nTool];
1979 /* copy tool data */
1980 toolPtr->uFlags = lpToolInfo->uFlags;
1981 toolPtr->hwnd = lpToolInfo->hwnd;
1982 toolPtr->uId = lpToolInfo->uId;
1983 toolPtr->rect = lpToolInfo->rect;
1984 toolPtr->hinst = lpToolInfo->hinst;
1986 if (HIWORD(lpToolInfo->lpszText) == 0) {
1987 TRACE("set string id %x!\n", (INT)lpToolInfo->lpszText);
1988 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText;
1990 else if (lpToolInfo->lpszText) {
1991 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA)
1992 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
1994 if ( (toolPtr->lpszText) &&
1995 (HIWORD((INT)toolPtr->lpszText) != 0) ) {
1996 Free (toolPtr->lpszText);
1997 toolPtr->lpszText = NULL;
1999 if (lpToolInfo->lpszText) {
2000 INT len = MultiByteToWideChar(CP_ACP, 0, lpToolInfo->lpszText,
2002 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
2003 MultiByteToWideChar(CP_ACP, 0, lpToolInfo->lpszText, -1,
2004 toolPtr->lpszText, len);
2009 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA))
2010 toolPtr->lParam = lpToolInfo->lParam;
2017 TOOLTIPS_SetToolInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
2019 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2020 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
2021 TTTOOL_INFO *toolPtr;
2024 if (lpToolInfo == NULL)
2026 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
2029 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo);
2030 if (nTool == -1) return 0;
2032 TRACE("tool %d\n", nTool);
2034 toolPtr = &infoPtr->tools[nTool];
2036 /* copy tool data */
2037 toolPtr->uFlags = lpToolInfo->uFlags;
2038 toolPtr->hwnd = lpToolInfo->hwnd;
2039 toolPtr->uId = lpToolInfo->uId;
2040 toolPtr->rect = lpToolInfo->rect;
2041 toolPtr->hinst = lpToolInfo->hinst;
2043 if (HIWORD(lpToolInfo->lpszText) == 0) {
2044 TRACE("set string id %x!\n", (INT)lpToolInfo->lpszText);
2045 toolPtr->lpszText = lpToolInfo->lpszText;
2048 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW)
2049 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
2051 if ( (toolPtr->lpszText) &&
2052 (HIWORD((INT)toolPtr->lpszText) != 0) ) {
2053 Free (toolPtr->lpszText);
2054 toolPtr->lpszText = NULL;
2056 if (lpToolInfo->lpszText) {
2057 INT len = lstrlenW (lpToolInfo->lpszText);
2058 toolPtr->lpszText = Alloc ((len+1)*sizeof(WCHAR));
2059 strcpyW (toolPtr->lpszText, lpToolInfo->lpszText);
2064 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW))
2065 toolPtr->lParam = lpToolInfo->lParam;
2067 if (infoPtr->nCurrentTool == nTool)
2069 TOOLTIPS_GetTipText (hwnd, infoPtr, infoPtr->nCurrentTool);
2071 if (infoPtr->szTipText[0] == 0)
2072 TOOLTIPS_Hide(hwnd, infoPtr);
2074 TOOLTIPS_Show (hwnd, infoPtr);
2082 TOOLTIPS_TrackActivate (HWND hwnd, WPARAM wParam, LPARAM lParam)
2084 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2087 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
2089 if (lpToolInfo == NULL)
2091 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
2095 infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
2096 if (infoPtr->nTrackTool != -1) {
2097 TRACE("activated!\n");
2098 infoPtr->bTrackActive = TRUE;
2099 TOOLTIPS_TrackShow (hwnd, infoPtr);
2104 TOOLTIPS_TrackHide (hwnd, infoPtr);
2106 infoPtr->bTrackActive = FALSE;
2107 infoPtr->nTrackTool = -1;
2109 TRACE("deactivated!\n");
2117 TOOLTIPS_TrackPosition (HWND hwnd, WPARAM wParam, LPARAM lParam)
2119 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2121 infoPtr->xTrackPos = (INT)LOWORD(lParam);
2122 infoPtr->yTrackPos = (INT)HIWORD(lParam);
2124 if (infoPtr->bTrackActive) {
2126 infoPtr->xTrackPos, infoPtr->yTrackPos);
2128 TOOLTIPS_TrackShow (hwnd, infoPtr);
2136 TOOLTIPS_Update (HWND hwnd, WPARAM wParam, LPARAM lParam)
2138 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2140 if (infoPtr->nCurrentTool != -1)
2141 UpdateWindow (hwnd);
2148 TOOLTIPS_UpdateTipTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
2150 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2151 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
2152 TTTOOL_INFO *toolPtr;
2155 if (lpToolInfo == NULL)
2157 if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
2160 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
2161 if (nTool == -1) return 0;
2163 TRACE("tool %d\n", nTool);
2165 toolPtr = &infoPtr->tools[nTool];
2167 /* copy tool text */
2168 toolPtr->hinst = lpToolInfo->hinst;
2170 if (HIWORD(lpToolInfo->lpszText) == 0){
2171 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText;
2173 else if (lpToolInfo->lpszText) {
2174 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA)
2175 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
2177 if ( (toolPtr->lpszText) &&
2178 (HIWORD((INT)toolPtr->lpszText) != 0) ) {
2179 Free (toolPtr->lpszText);
2180 toolPtr->lpszText = NULL;
2182 if (lpToolInfo->lpszText) {
2183 INT len = MultiByteToWideChar(CP_ACP, 0, lpToolInfo->lpszText,
2185 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
2186 MultiByteToWideChar(CP_ACP, 0, lpToolInfo->lpszText, -1,
2187 toolPtr->lpszText, len);
2192 if(infoPtr->nCurrentTool == -1) return 0;
2194 if (infoPtr->bActive)
2195 TOOLTIPS_Show (hwnd, infoPtr);
2196 else if (infoPtr->bTrackActive)
2197 TOOLTIPS_TrackShow (hwnd, infoPtr);
2204 TOOLTIPS_UpdateTipTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
2206 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2207 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
2208 TTTOOL_INFO *toolPtr;
2211 if (lpToolInfo == NULL)
2213 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
2216 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo);
2220 TRACE("tool %d\n", nTool);
2222 toolPtr = &infoPtr->tools[nTool];
2224 /* copy tool text */
2225 toolPtr->hinst = lpToolInfo->hinst;
2227 if (HIWORD(lpToolInfo->lpszText) == 0){
2228 toolPtr->lpszText = lpToolInfo->lpszText;
2230 else if (lpToolInfo->lpszText) {
2231 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW)
2232 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
2234 if ( (toolPtr->lpszText) &&
2235 (HIWORD((INT)toolPtr->lpszText) != 0) ) {
2236 Free (toolPtr->lpszText);
2237 toolPtr->lpszText = NULL;
2239 if (lpToolInfo->lpszText) {
2240 INT len = lstrlenW (lpToolInfo->lpszText);
2241 toolPtr->lpszText = Alloc ((len+1)*sizeof(WCHAR));
2242 strcpyW (toolPtr->lpszText, lpToolInfo->lpszText);
2247 if(infoPtr->nCurrentTool == -1) return 0;
2249 if (infoPtr->bActive)
2250 TOOLTIPS_Show (hwnd, infoPtr);
2251 else if (infoPtr->bTrackActive)
2252 TOOLTIPS_TrackShow (hwnd, infoPtr);
2259 TOOLTIPS_WindowFromPoint (HWND hwnd, WPARAM wParam, LPARAM lParam)
2261 return (LRESULT)WindowFromPoint (*((LPPOINT)lParam));
2267 TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
2269 TOOLTIPS_INFO *infoPtr;
2271 /* allocate memory for info structure */
2272 infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO));
2273 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
2275 /* initialize info structure */
2276 infoPtr->bActive = TRUE;
2277 infoPtr->bTrackActive = FALSE;
2279 infoPtr->nMaxTipWidth = -1;
2280 infoPtr->nTool = -1;
2281 infoPtr->nCurrentTool = -1;
2282 infoPtr->nTrackTool = -1;
2284 /* initialize colours and fonts */
2285 TOOLTIPS_InitSystemSettings(infoPtr);
2287 TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L);
2289 SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
2296 TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
2298 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2299 TTTOOL_INFO *toolPtr;
2303 if (infoPtr->tools) {
2304 for (i = 0; i < infoPtr->uNumTools; i++) {
2305 toolPtr = &infoPtr->tools[i];
2306 if (toolPtr->lpszText) {
2307 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
2308 (HIWORD((INT)toolPtr->lpszText) != 0) )
2310 Free (toolPtr->lpszText);
2311 toolPtr->lpszText = NULL;
2315 /* remove subclassing */
2316 if (toolPtr->uFlags & TTF_SUBCLASS) {
2317 if (toolPtr->uFlags & TTF_IDISHWND) {
2318 RemoveWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1);
2321 RemoveWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1);
2325 Free (infoPtr->tools);
2328 /* free title string */
2329 Free (infoPtr->pszTitle);
2330 /* free title icon if not a standard one */
2331 if (TOOLTIPS_GetTitleIconIndex(infoPtr->hTitleIcon) > TTI_ERROR)
2332 DeleteObject(infoPtr->hTitleIcon);
2335 DeleteObject (infoPtr->hFont);
2336 DeleteObject (infoPtr->hTitleFont);
2338 /* free tool tips info data */
2340 SetWindowLongPtrW(hwnd, 0, 0);
2346 TOOLTIPS_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
2348 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2350 return (LRESULT)infoPtr->hFont;
2355 TOOLTIPS_MouseMessage (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2357 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2359 TOOLTIPS_Hide (hwnd, infoPtr);
2366 TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
2368 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
2369 DWORD dwExStyle = GetWindowLongA (hwnd, GWL_EXSTYLE);
2371 dwStyle &= 0x0000FFFF;
2372 dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS);
2374 /* WS_BORDER only draws a border round the window rect, not the
2375 * window region, therefore it is useless to us in balloon mode */
2376 if (dwStyle & TTS_BALLOON) dwStyle &= ~WS_BORDER;
2378 SetWindowLongA (hwnd, GWL_STYLE, dwStyle);
2380 dwExStyle |= WS_EX_TOOLWINDOW;
2381 SetWindowLongA (hwnd, GWL_EXSTYLE, dwExStyle);
2388 TOOLTIPS_NCHitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
2390 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2391 INT nTool = (infoPtr->bTrackActive) ? infoPtr->nTrackTool : infoPtr->nTool;
2393 TRACE(" nTool=%d\n", nTool);
2395 if ((nTool > -1) && (nTool < infoPtr->uNumTools)) {
2396 if (infoPtr->tools[nTool].uFlags & TTF_TRANSPARENT) {
2397 TRACE("-- in transparent mode!\n");
2398 return HTTRANSPARENT;
2402 return DefWindowProcA (hwnd, WM_NCHITTEST, wParam, lParam);
2407 TOOLTIPS_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
2409 FIXME ("hwnd=%p wParam=%x lParam=%lx\n", hwnd, wParam, lParam);
2416 TOOLTIPS_Paint (HWND hwnd, WPARAM wParam, LPARAM lParam)
2421 hdc = (wParam == 0) ? BeginPaint (hwnd, &ps) : (HDC)wParam;
2422 TOOLTIPS_Refresh (hwnd, hdc);
2424 EndPaint (hwnd, &ps);
2430 TOOLTIPS_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
2432 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2435 if(!GetObjectW((HFONT)wParam, sizeof(lf), &lf))
2438 DeleteObject (infoPtr->hFont);
2439 infoPtr->hFont = CreateFontIndirectW(&lf);
2441 DeleteObject (infoPtr->hTitleFont);
2442 lf.lfWeight = FW_BOLD;
2443 infoPtr->hTitleFont = CreateFontIndirectW(&lf);
2445 if ((LOWORD(lParam)) & (infoPtr->nCurrentTool != -1)) {
2446 FIXME("full redraw needed!\n");
2451 /******************************************************************
2452 * TOOLTIPS_OnWMGetTextLength
2454 * This function is called when the tooltip receive a
2455 * WM_GETTEXTLENGTH message.
2459 * returns the length, in characters, of the tip text
2460 ******************************************************************/
2462 TOOLTIPS_OnWMGetTextLength(HWND hwnd, WPARAM wParam, LPARAM lParam)
2464 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2465 return lstrlenW(infoPtr->szTipText);
2468 /******************************************************************
2469 * TOOLTIPS_OnWMGetText
2471 * This function is called when the tooltip receive a
2472 * WM_GETTEXT message.
2473 * wParam : specifies the maximum number of characters to be copied
2474 * lParam : is the pointer to the buffer that will receive
2477 * returns the number of characters copied
2478 ******************************************************************/
2480 TOOLTIPS_OnWMGetText (HWND hwnd, WPARAM wParam, LPARAM lParam)
2482 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2484 if(!infoPtr || !(infoPtr->szTipText))
2487 return WideCharToMultiByte(CP_ACP, 0, infoPtr->szTipText, -1,
2488 (LPSTR)lParam, wParam, NULL, NULL);
2492 TOOLTIPS_Timer (HWND hwnd, WPARAM wParam, LPARAM lParam)
2494 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2497 TRACE("timer %d (%p) expired!\n", wParam, hwnd);
2501 KillTimer (hwnd, ID_TIMERSHOW);
2502 nOldTool = infoPtr->nTool;
2503 if ((infoPtr->nTool = TOOLTIPS_CheckTool (hwnd, TRUE)) == nOldTool)
2504 TOOLTIPS_Show (hwnd, infoPtr);
2508 TOOLTIPS_Hide (hwnd, infoPtr);
2512 nOldTool = infoPtr->nTool;
2513 infoPtr->nTool = TOOLTIPS_CheckTool (hwnd, FALSE);
2514 TRACE("tool (%p) %d %d %d\n", hwnd, nOldTool,
2515 infoPtr->nTool, infoPtr->nCurrentTool);
2516 if (infoPtr->nTool != nOldTool) {
2517 if(infoPtr->nTool == -1) { /* Moved out of all tools */
2518 TOOLTIPS_Hide(hwnd, infoPtr);
2519 KillTimer(hwnd, ID_TIMERLEAVE);
2520 } else if (nOldTool == -1) { /* Moved from outside */
2521 ERR("How did this happen?\n");
2522 } else { /* Moved from one to another */
2523 TOOLTIPS_Hide (hwnd, infoPtr);
2524 KillTimer(hwnd, ID_TIMERLEAVE);
2525 if(infoPtr->bActive) {
2526 SetTimer (hwnd, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
2527 TRACE("timer 1 started!\n");
2534 ERR("Unknown timer id %d\n", wParam);
2542 TOOLTIPS_WinIniChange (HWND hwnd, WPARAM wParam, LPARAM lParam)
2544 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
2546 TOOLTIPS_InitSystemSettings (infoPtr);
2553 TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
2559 case WM_LBUTTONDOWN:
2561 case WM_MBUTTONDOWN:
2563 case WM_RBUTTONDOWN:
2567 msg.wParam = wParam;
2568 msg.lParam = lParam;
2569 TOOLTIPS_RelayEvent((HWND)dwRef, 0, (LPARAM)&msg);
2575 return DefSubclassProc(hwnd, uMsg, wParam, lParam);
2579 static LRESULT CALLBACK
2580 TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2582 TRACE("hwnd=%p msg=%x wparam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);
2583 if (!TOOLTIPS_GetInfoPtr(hwnd) && (uMsg != WM_CREATE) && (uMsg != WM_NCCREATE))
2584 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
2588 return TOOLTIPS_Activate (hwnd, wParam, lParam);
2591 return TOOLTIPS_AddToolA (hwnd, wParam, lParam);
2594 return TOOLTIPS_AddToolW (hwnd, wParam, lParam);
2597 return TOOLTIPS_DelToolA (hwnd, wParam, lParam);
2600 return TOOLTIPS_DelToolW (hwnd, wParam, lParam);
2602 case TTM_ENUMTOOLSA:
2603 return TOOLTIPS_EnumToolsA (hwnd, wParam, lParam);
2605 case TTM_ENUMTOOLSW:
2606 return TOOLTIPS_EnumToolsW (hwnd, wParam, lParam);
2608 case TTM_GETBUBBLESIZE:
2609 return TOOLTIPS_GetBubbleSize (hwnd, wParam, lParam);
2611 case TTM_GETCURRENTTOOLA:
2612 return TOOLTIPS_GetCurrentToolA (hwnd, wParam, lParam);
2614 case TTM_GETCURRENTTOOLW:
2615 return TOOLTIPS_GetCurrentToolW (hwnd, wParam, lParam);
2617 case TTM_GETDELAYTIME:
2618 return TOOLTIPS_GetDelayTime (hwnd, wParam, lParam);
2621 return TOOLTIPS_GetMargin (hwnd, wParam, lParam);
2623 case TTM_GETMAXTIPWIDTH:
2624 return TOOLTIPS_GetMaxTipWidth (hwnd, wParam, lParam);
2627 return TOOLTIPS_GetTextA (hwnd, wParam, lParam);
2630 return TOOLTIPS_GetTextW (hwnd, wParam, lParam);
2632 case TTM_GETTIPBKCOLOR:
2633 return TOOLTIPS_GetTipBkColor (hwnd, wParam, lParam);
2635 case TTM_GETTIPTEXTCOLOR:
2636 return TOOLTIPS_GetTipTextColor (hwnd, wParam, lParam);
2638 case TTM_GETTOOLCOUNT:
2639 return TOOLTIPS_GetToolCount (hwnd, wParam, lParam);
2641 case TTM_GETTOOLINFOA:
2642 return TOOLTIPS_GetToolInfoA (hwnd, wParam, lParam);
2644 case TTM_GETTOOLINFOW:
2645 return TOOLTIPS_GetToolInfoW (hwnd, wParam, lParam);
2648 return TOOLTIPS_HitTestA (hwnd, wParam, lParam);
2651 return TOOLTIPS_HitTestW (hwnd, wParam, lParam);
2653 case TTM_NEWTOOLRECTA:
2654 return TOOLTIPS_NewToolRectA (hwnd, wParam, lParam);
2656 case TTM_NEWTOOLRECTW:
2657 return TOOLTIPS_NewToolRectW (hwnd, wParam, lParam);
2660 return TOOLTIPS_Pop (hwnd, wParam, lParam);
2662 case TTM_RELAYEVENT:
2663 return TOOLTIPS_RelayEvent (hwnd, wParam, lParam);
2665 case TTM_SETDELAYTIME:
2666 return TOOLTIPS_SetDelayTime (hwnd, wParam, lParam);
2669 return TOOLTIPS_SetMargin (hwnd, wParam, lParam);
2671 case TTM_SETMAXTIPWIDTH:
2672 return TOOLTIPS_SetMaxTipWidth (hwnd, wParam, lParam);
2674 case TTM_SETTIPBKCOLOR:
2675 return TOOLTIPS_SetTipBkColor (hwnd, wParam, lParam);
2677 case TTM_SETTIPTEXTCOLOR:
2678 return TOOLTIPS_SetTipTextColor (hwnd, wParam, lParam);
2681 return TOOLTIPS_SetTitleA (hwnd, wParam, lParam);
2684 return TOOLTIPS_SetTitleW (hwnd, wParam, lParam);
2686 case TTM_SETTOOLINFOA:
2687 return TOOLTIPS_SetToolInfoA (hwnd, wParam, lParam);
2689 case TTM_SETTOOLINFOW:
2690 return TOOLTIPS_SetToolInfoW (hwnd, wParam, lParam);
2692 case TTM_TRACKACTIVATE:
2693 return TOOLTIPS_TrackActivate (hwnd, wParam, lParam);
2695 case TTM_TRACKPOSITION:
2696 return TOOLTIPS_TrackPosition (hwnd, wParam, lParam);
2699 return TOOLTIPS_Update (hwnd, wParam, lParam);
2701 case TTM_UPDATETIPTEXTA:
2702 return TOOLTIPS_UpdateTipTextA (hwnd, wParam, lParam);
2704 case TTM_UPDATETIPTEXTW:
2705 return TOOLTIPS_UpdateTipTextW (hwnd, wParam, lParam);
2707 case TTM_WINDOWFROMPOINT:
2708 return TOOLTIPS_WindowFromPoint (hwnd, wParam, lParam);
2712 return TOOLTIPS_Create (hwnd, (LPCREATESTRUCTW)lParam);
2715 return TOOLTIPS_Destroy (hwnd, wParam, lParam);
2718 /* we draw the background in WM_PAINT */
2722 return TOOLTIPS_GetFont (hwnd, wParam, lParam);
2725 return TOOLTIPS_OnWMGetText (hwnd, wParam, lParam);
2727 case WM_GETTEXTLENGTH:
2728 return TOOLTIPS_OnWMGetTextLength (hwnd, wParam, lParam);
2731 case WM_LBUTTONDOWN:
2733 case WM_MBUTTONDOWN:
2735 case WM_RBUTTONDOWN:
2738 return TOOLTIPS_MouseMessage (hwnd, uMsg, wParam, lParam);
2741 return TOOLTIPS_NCCreate (hwnd, wParam, lParam);
2744 return TOOLTIPS_NCHitTest (hwnd, wParam, lParam);
2746 case WM_NOTIFYFORMAT:
2747 return TOOLTIPS_NotifyFormat (hwnd, wParam, lParam);
2750 return TOOLTIPS_Paint (hwnd, wParam, lParam);
2753 return TOOLTIPS_SetFont (hwnd, wParam, lParam);
2756 return TOOLTIPS_Timer (hwnd, wParam, lParam);
2758 case WM_WININICHANGE:
2759 return TOOLTIPS_WinIniChange (hwnd, wParam, lParam);
2762 if ((uMsg >= WM_USER) && (uMsg < WM_APP))
2763 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
2764 uMsg, wParam, lParam);
2765 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
2772 TOOLTIPS_Register (void)
2776 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
2777 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
2778 wndClass.lpfnWndProc = (WNDPROC)TOOLTIPS_WindowProc;
2779 wndClass.cbClsExtra = 0;
2780 wndClass.cbWndExtra = sizeof(TOOLTIPS_INFO *);
2781 wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);
2782 wndClass.hbrBackground = 0;
2783 wndClass.lpszClassName = TOOLTIPS_CLASSA;
2785 RegisterClassA (&wndClass);
2787 hTooltipIcons[TTI_NONE] = NULL;
2788 hTooltipIcons[TTI_INFO] = LoadImageW(COMCTL32_hModule,
2789 (LPCWSTR)MAKEINTRESOURCE(IDI_TT_INFO_SM), IMAGE_ICON, 0, 0, 0);
2790 hTooltipIcons[TTI_WARNING] = LoadImageW(COMCTL32_hModule,
2791 (LPCWSTR)MAKEINTRESOURCE(IDI_TT_WARN_SM), IMAGE_ICON, 0, 0, 0);
2792 hTooltipIcons[TTI_ERROR] = LoadImageW(COMCTL32_hModule,
2793 (LPCWSTR)MAKEINTRESOURCE(IDI_TT_ERROR_SM), IMAGE_ICON, 0, 0, 0);
2798 TOOLTIPS_Unregister (void)
2801 for (i = 0; i < TTI_ERROR+1; i++)
2802 DeleteObject(hTooltipIcons[i]);
2803 UnregisterClassA (TOOLTIPS_CLASSA, NULL);