Changeset 180 for trunk/src/comctl32/tooltips.c
- Timestamp:
- Jun 24, 1999, 6:37:46 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/tooltips.c
r110 r180 1 /* $Id: tooltips.c,v 1. 5 1999-06-16 20:25:44cbratschi Exp $ */1 /* $Id: tooltips.c,v 1.6 1999-06-24 16:37:45 cbratschi Exp $ */ 2 2 /* 3 3 * Tool tip control … … 18 18 */ 19 19 20 /* CB: Odin32 problems 21 - not defined colors: COLOR_INFOBK, COLOR_INFOTEXT 22 - WM_NCCREATE not handled first -> title bar visible if WS_POPUP wasn't set before 23 */ 24 20 25 #include <string.h> 21 26 … … 53 58 UINT uFlags = DT_EXTERNALLEADING; 54 59 55 if (infoPtr->nMaxTipWidth > -1) 56 uFlags |= DT_WORDBREAK; 57 if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX) 58 uFlags |= DT_NOPREFIX; 59 GetClientRect (hwnd, &rc); 60 if (infoPtr->nMaxTipWidth > -1) uFlags |= DT_WORDBREAK; 61 if (GetWindowLongA(hwnd,GWL_STYLE) & TTS_NOPREFIX) uFlags |= DT_NOPREFIX; 62 GetClientRect(hwnd,&rc); 60 63 61 64 /* fill the background */ 62 hBrush = CreateSolidBrush 63 FillRect (hdc, &rc,hBrush);64 DeleteObject 65 hBrush = CreateSolidBrush(infoPtr->clrBk); 66 FillRect(hdc,&rc,hBrush); 67 DeleteObject(hBrush); 65 68 66 69 /* calculate text rectangle */ 67 rc.left += (2 +infoPtr->rcMargin.left);68 rc.top += (2 +infoPtr->rcMargin.top);69 rc.right -= (2 +infoPtr->rcMargin.right);70 rc.bottom -= (2 +infoPtr->rcMargin.bottom);70 rc.left += (2+infoPtr->rcMargin.left); 71 rc.top += (2+infoPtr->rcMargin.top); 72 rc.right -= (2+infoPtr->rcMargin.right); 73 rc.bottom -= (2+infoPtr->rcMargin.bottom); 71 74 72 75 /* draw text */ 73 oldBkMode = SetBkMode (hdc, TRANSPARENT); 74 SetTextColor (hdc, infoPtr->clrText); 75 hOldFont = SelectObject (hdc, infoPtr->hFont); 76 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags); 77 SelectObject (hdc, hOldFont); 78 if (oldBkMode != TRANSPARENT) 79 SetBkMode (hdc, oldBkMode); 76 oldBkMode = SetBkMode(hdc,TRANSPARENT); 77 SetTextColor(hdc,infoPtr->clrText); 78 hOldFont = SelectObject(hdc,infoPtr->hFont); 79 DrawTextW(hdc,infoPtr->szTipText,-1,&rc,uFlags); 80 SelectObject(hdc,hOldFont); 81 if (oldBkMode != TRANSPARENT) SetBkMode(hdc,oldBkMode); 80 82 } 81 83 82 84 83 85 static VOID 84 TOOLTIPS_GetTipText (HWND hwnd, TOOLTIPS_INFO *infoPtr,INT nTool)86 TOOLTIPS_GetTipText(HWND hwnd,TOOLTIPS_INFO *infoPtr,INT nTool) 85 87 { 86 88 TTTOOL_INFO *toolPtr = &infoPtr->tools[nTool]; 87 89 88 if ((toolPtr->hinst) && (HIWORD((UINT)toolPtr->lpszText) == 0)) {89 /* load a resource */90 // TRACE (tooltips, "load res string %x %x\n", 91 // toolPtr->hinst,(int)toolPtr->lpszText);92 LoadStringW (toolPtr->hinst, (UINT)toolPtr->lpszText,93 infoPtr->szTipText, INFOTIPSIZE);94 }95 else if (toolPtr->lpszText) {96 if (toolPtr->lpszText == LPSTR_TEXTCALLBACKW){97 98 99 100 ZeroMemory (&ttnmdi,sizeof(NMTTDISPINFOA));101 102 103 104 105 106 107 108 // TRACE (tooltips, "hdr.idFrom = %x\n", ttnmdi.hdr.idFrom);109 SendMessageA (toolPtr->hwnd, WM_NOTIFY, 110 (WPARAM)toolPtr->uId, (LPARAM)&ttnmdi);111 112 if ((ttnmdi.hinst) && (HIWORD((UINT)ttnmdi.szText) == 0)) {113 LoadStringW (ttnmdi.hinst, (UINT)ttnmdi.szText,114 infoPtr->szTipText, INFOTIPSIZE);115 if (ttnmdi.uFlags & TTF_DI_SETITEM) {116 toolPtr->hinst = ttnmdi.hinst;117 toolPtr->lpszText = (LPWSTR)ttnmdi.szText;118 }119 }120 else if (ttnmdi.szText[0]) {121 lstrcpynAtoW (infoPtr->szTipText, ttnmdi.szText, 80);122 if (ttnmdi.uFlags & TTF_DI_SETITEM){123 INT len = lstrlenA(ttnmdi.szText);124 125 toolPtr->lpszText = COMCTL32_Alloc((len+1)* sizeof(WCHAR));126 lstrcpyAtoW (toolPtr->lpszText,ttnmdi.szText);127 128 }129 else if (ttnmdi.lpszText == 0){130 131 132 }133 else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA){134 lstrcpynAtoW (infoPtr->szTipText, ttnmdi.lpszText,INFOTIPSIZE);135 if (ttnmdi.uFlags & TTF_DI_SETITEM) {136 INT len = lstrlenA (ttnmdi.lpszText);137 toolPtr->hinst = 0;138 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));139 lstrcpyAtoW (toolPtr->lpszText, ttnmdi.lpszText);140 }141 142 else {143 // ERR (tooltips, "recursive text callback!\n"); 144 infoPtr->szTipText[0] = '\0';145 }90 if ((toolPtr->hinst) && (HIWORD((UINT)toolPtr->lpszText) == 0)) 91 { 92 /* load a resource */ 93 // TRACE (tooltips,"load res string %x %x\n",toolPtr->hinst,(int)toolPtr->lpszText); 94 LoadStringW(toolPtr->hinst,(UINT)toolPtr->lpszText,infoPtr->szTipText,INFOTIPSIZE); 95 } else if (toolPtr->lpszText) 96 { 97 if (toolPtr->lpszText == LPSTR_TEXTCALLBACKW) 98 { 99 NMTTDISPINFOA ttnmdi; 100 101 /* fill NMHDR struct */ 102 ZeroMemory (&ttnmdi,sizeof(NMTTDISPINFOA)); 103 ttnmdi.hdr.hwndFrom = hwnd; 104 ttnmdi.hdr.idFrom = toolPtr->uId; 105 ttnmdi.hdr.code = TTN_GETDISPINFOA; 106 ttnmdi.lpszText = (LPSTR)&ttnmdi.szText; 107 ttnmdi.uFlags = toolPtr->uFlags; 108 ttnmdi.lParam = toolPtr->lParam; 109 // TRACE (tooltips, "hdr.idFrom = %x\n", ttnmdi.hdr.idFrom); 110 SendMessageA (toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&ttnmdi); 111 112 if ((ttnmdi.hinst) && (HIWORD((UINT)ttnmdi.szText) == 0)) 113 { 114 LoadStringW (ttnmdi.hinst,(UINT)ttnmdi.szText,infoPtr->szTipText,INFOTIPSIZE); 115 if (ttnmdi.uFlags & TTF_DI_SETITEM) 116 { 117 toolPtr->hinst = ttnmdi.hinst; 118 toolPtr->lpszText = (LPWSTR)ttnmdi.szText; 119 } 120 } else if (ttnmdi.szText[0]) 121 { 122 lstrcpynAtoW (infoPtr->szTipText,ttnmdi.szText,80); 123 if (ttnmdi.uFlags & TTF_DI_SETITEM) 124 { 125 INT len = lstrlenA(ttnmdi.szText); 126 toolPtr->hinst = 0; 127 toolPtr->lpszText = COMCTL32_Alloc((len+1)* sizeof(WCHAR)); 128 lstrcpyAtoW(toolPtr->lpszText,ttnmdi.szText); 129 } 130 } else if (ttnmdi.lpszText == 0) 131 { 132 /* no text available */ 133 infoPtr->szTipText[0] = L'\0'; 134 } else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) 135 { 136 lstrcpynAtoW(infoPtr->szTipText,ttnmdi.lpszText,INFOTIPSIZE); 137 if (ttnmdi.uFlags & TTF_DI_SETITEM) 138 { 139 INT len = lstrlenA(ttnmdi.lpszText); 140 toolPtr->hinst = 0; 141 toolPtr->lpszText = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 142 lstrcpyAtoW(toolPtr->lpszText,ttnmdi.lpszText); 143 } 144 } else 145 { 146 // ERR (tooltips, "recursive text callback!\n"); 147 infoPtr->szTipText[0] = '\0'; 146 148 } 147 else { 148 /* the item is a usual (unicode) text */ 149 // lstrcpynW (infoPtr->szTipText, toolPtr->lpszText, INFOTIPSIZE); 150 strncpy(infoPtr->szTipText, toolPtr->lpszText, INFOTIPSIZE); 151 } 152 } 153 else { 154 /* no text available */ 155 infoPtr->szTipText[0] = L'\0'; 149 } else 150 { 151 /* the item is a usual (unicode) text */ 152 lstrcpynW (infoPtr->szTipText,toolPtr->lpszText,INFOTIPSIZE); 153 } 154 } 155 else 156 { 157 /* no text available */ 158 infoPtr->szTipText[0] = L'\0'; 156 159 } 157 160 … … 159 162 } 160 163 161 162 164 static VOID 163 TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr,LPSIZE lpSize)165 TOOLTIPS_CalcTipSize (HWND hwnd,TOOLTIPS_INFO *infoPtr,LPSIZE lpSize) 164 166 { 165 167 HDC hdc; 166 168 HFONT hOldFont; 167 169 UINT uFlags = DT_EXTERNALLEADING | DT_CALCRECT; 168 RECT rc = {0, 0, 0,0};169 170 if (infoPtr->nMaxTipWidth > -1) {171 rc.right = infoPtr->nMaxTipWidth;172 uFlags |= DT_WORDBREAK;173 }174 if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX)175 170 RECT rc = {0,0,0,0}; 171 172 if (infoPtr->nMaxTipWidth > -1) 173 { 174 rc.right = infoPtr->nMaxTipWidth; 175 uFlags |= DT_WORDBREAK; 176 } 177 if (GetWindowLongA(hwnd,GWL_STYLE) & TTS_NOPREFIX) uFlags |= DT_NOPREFIX; 176 178 // TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText)); 177 179 178 hdc = GetDC (hwnd); 179 hOldFont = SelectObject (hdc, infoPtr->hFont); 180 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags); 181 SelectObject (hdc, hOldFont); 182 ReleaseDC (hwnd, hdc); 183 184 lpSize->cx = rc.right - rc.left + 4 + 185 infoPtr->rcMargin.left + infoPtr->rcMargin.right; 186 lpSize->cy = rc.bottom - rc.top + 4 + 187 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top; 180 hdc = GetDC(hwnd); 181 hOldFont = SelectObject(hdc,infoPtr->hFont); 182 DrawTextW(hdc,infoPtr->szTipText,-1,&rc,uFlags); 183 SelectObject(hdc,hOldFont); 184 ReleaseDC(hwnd,hdc); 185 186 lpSize->cx = rc.right-rc.left+4+infoPtr->rcMargin.left+infoPtr->rcMargin.right; 187 lpSize->cy = rc.bottom-rc.top+4+infoPtr->rcMargin.bottom+infoPtr->rcMargin.top; 188 188 } 189 189 … … 198 198 NMHDR hdr; 199 199 200 if (infoPtr->nTool == -1) { 200 if (infoPtr->nTool == -1) 201 { 201 202 // TRACE (tooltips, "invalid tool (-1)!\n"); 202 203 return; … … 207 208 // TRACE (tooltips, "Show tooltip pre %d!\n", infoPtr->nTool); 208 209 209 TOOLTIPS_GetTipText (hwnd, infoPtr, infoPtr->nCurrentTool); 210 211 if (infoPtr->szTipText[0] == L'\0') { 210 TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nCurrentTool); 211 212 if (infoPtr->szTipText[0] == L'\0') 213 { 212 214 infoPtr->nCurrentTool = -1; 213 215 return; … … 220 222 hdr.idFrom = toolPtr->uId; 221 223 hdr.code = TTN_SHOW; 222 SendMessageA (toolPtr->hwnd,WM_NOTIFY,223 (WPARAM)toolPtr->uId, 224 SendMessageA(toolPtr->hwnd,WM_NOTIFY, 225 (WPARAM)toolPtr->uId,(LPARAM)&hdr); 224 226 225 227 // TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText)); … … 228 230 // TRACE (tooltips, "size %d - %d\n", size.cx, size.cy); 229 231 230 if (toolPtr->uFlags & TTF_CENTERTIP) { 232 if (toolPtr->uFlags & TTF_CENTERTIP) 233 { 231 234 RECT rc; 232 235 233 236 if (toolPtr->uFlags & TTF_IDISHWND) 234 237 GetWindowRect ((HWND)toolPtr->uId, &rc); 235 else { 238 else 239 { 236 240 rc = toolPtr->rect; 237 241 MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2); … … 239 243 rect.left = (rc.left + rc.right - size.cx) / 2; 240 244 rect.top = rc.bottom + 2; 241 } 242 else{243 GetCursorPos 245 } else 246 { 247 GetCursorPos((LPPOINT)&rect); 244 248 rect.top += 20; 245 249 } … … 252 256 rect.bottom = rect.top + size.cy; 253 257 254 AdjustWindowRectEx (&rect, GetWindowLongA(hwnd, GWL_STYLE),255 FALSE, GetWindowLongA(hwnd, GWL_EXSTYLE));256 257 SetWindowPos (hwnd, HWND_TOP, rect.left,rect.top,258 rect.right - rect.left, rect.bottom -rect.top,258 AdjustWindowRectEx (&rect,GetWindowLongA(hwnd, GWL_STYLE), 259 FALSE,GetWindowLongA(hwnd, GWL_EXSTYLE)); 260 261 SetWindowPos (hwnd,HWND_TOP,rect.left,rect.top, 262 rect.right-rect.left,rect.bottom-rect.top, 259 263 SWP_SHOWWINDOW | SWP_NOACTIVATE); 260 264 261 265 /* repaint the tooltip */ 262 hdc = GetDC 263 TOOLTIPS_Refresh (hwnd,hdc);264 ReleaseDC (hwnd,hdc);265 266 SetTimer (hwnd, ID_TIMERPOP, infoPtr->nAutoPopTime,0);266 hdc = GetDC(hwnd); 267 TOOLTIPS_Refresh(hwnd,hdc); 268 ReleaseDC(hwnd,hdc); 269 270 SetTimer (hwnd,ID_TIMERPOP,infoPtr->nAutoPopTime,0); 267 271 } 268 272 … … 303 307 NMHDR hdr; 304 308 305 if (infoPtr->nTrackTool == -1) { 306 // TRACE (tooltips, "invalid tracking tool (-1)!\n"); 307 return; 309 if (infoPtr->nTrackTool == -1) 310 { 311 // TRACE (tooltips, "invalid tracking tool (-1)!\n"); 312 return; 308 313 } 309 314 310 315 // TRACE (tooltips, "show tracking tooltip pre %d!\n", infoPtr->nTrackTool); 311 316 312 TOOLTIPS_GetTipText (hwnd, infoPtr, infoPtr->nTrackTool); 313 314 if (infoPtr->szTipText[0] == L'\0') { 315 infoPtr->nTrackTool = -1; 316 return; 317 TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nTrackTool); 318 319 if (infoPtr->szTipText[0] == L'\0') 320 { 321 infoPtr->nTrackTool = -1; 322 return; 317 323 } 318 324 … … 323 329 hdr.idFrom = toolPtr->uId; 324 330 hdr.code = TTN_SHOW; 325 SendMessageA (toolPtr->hwnd, WM_NOTIFY, 326 (WPARAM)toolPtr->uId, (LPARAM)&hdr); 331 SendMessageA(toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&hdr); 327 332 328 333 // TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText)); 329 334 330 TOOLTIPS_CalcTipSize (hwnd, infoPtr,&size);335 TOOLTIPS_CalcTipSize(hwnd,infoPtr,&size); 331 336 // TRACE (tooltips, "size %d - %d\n", size.cx, size.cy); 332 337 333 if (toolPtr->uFlags & TTF_ABSOLUTE) { 334 rect.left = infoPtr->xTrackPos; 335 rect.top = infoPtr->yTrackPos; 336 337 if (toolPtr->uFlags & TTF_CENTERTIP) { 338 rect.left -= (size.cx / 2); 339 rect.top -= (size.cy / 2); 340 } 341 } 342 else { 343 RECT rcTool; 344 345 if (toolPtr->uFlags & TTF_IDISHWND) 346 GetWindowRect ((HWND)toolPtr->uId, &rcTool); 347 else { 348 rcTool = toolPtr->rect; 349 MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rcTool, 2); 350 } 351 352 GetCursorPos ((LPPOINT)&rect); 353 rect.top += 20; 354 355 if (toolPtr->uFlags & TTF_CENTERTIP) { 356 rect.left -= (size.cx / 2); 357 rect.top -= (size.cy / 2); 358 } 359 360 /* smart placement */ 361 if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) && 362 (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom)) 363 rect.left = rcTool.right; 338 if (toolPtr->uFlags & TTF_ABSOLUTE) 339 { 340 rect.left = infoPtr->xTrackPos; 341 rect.top = infoPtr->yTrackPos; 342 343 if (toolPtr->uFlags & TTF_CENTERTIP) 344 { 345 rect.left -= (size.cx/2); 346 rect.top -= (size.cy/2); 347 } 348 } else 349 { 350 RECT rcTool; 351 352 if (toolPtr->uFlags & TTF_IDISHWND) 353 { 354 GetWindowRect((HWND)toolPtr->uId,&rcTool); //screen coordinates 355 } else 356 { 357 rcTool = toolPtr->rect; 358 MapWindowPoints(toolPtr->hwnd,(HWND)0,(LPPOINT)&rcTool,2); 359 } 360 361 GetCursorPos ((LPPOINT)&rect); 362 rect.top += 20; 363 364 if (toolPtr->uFlags & TTF_CENTERTIP) 365 { 366 rect.left -= (size.cx / 2); 367 rect.top -= (size.cy / 2); 368 } 369 370 /* smart placement */ 371 if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) && 372 (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom)) 373 rect.left = rcTool.right; 364 374 } 365 375 366 376 // TRACE (tooltips, "pos %d - %d\n", rect.left, rect.top); 367 377 368 rect.right = rect.left +size.cx;369 rect.bottom = rect.top +size.cy;370 371 AdjustWindowRectEx (&rect, GetWindowLongA (hwnd,GWL_STYLE),372 FALSE, GetWindowLongA (hwnd,GWL_EXSTYLE));373 374 SetWindowPos (hwnd, HWND_TOP, rect.left,rect.top,375 rect.right - rect.left, rect.bottom -rect.top,378 rect.right = rect.left+size.cx; 379 rect.bottom = rect.top+size.cy; 380 381 AdjustWindowRectEx (&rect,GetWindowLongA(hwnd,GWL_STYLE), 382 FALSE,GetWindowLongA(hwnd,GWL_EXSTYLE)); 383 384 SetWindowPos (hwnd,HWND_TOP,rect.left,rect.top, 385 rect.right-rect.left,rect.bottom-rect.top, 376 386 SWP_SHOWWINDOW | SWP_NOACTIVATE ); 377 387 … … 564 574 565 575 static LRESULT 566 TOOLTIPS_AddToolA (HWND hwnd, WPARAM wParam,LPARAM lParam)567 { 568 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr 576 TOOLTIPS_AddToolA(HWND hwnd,WPARAM wParam,LPARAM lParam) 577 { 578 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd); 569 579 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam; 570 580 TTTOOL_INFO *toolPtr; 571 581 582 if (lpToolInfo == NULL) return FALSE; 583 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) return FALSE; 584 585 // TRACE (tooltips, "add tool (%x) %x %d%s!\n", 586 // hwnd, lpToolInfo->hwnd, lpToolInfo->uId, 587 // (lpToolInfo->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : ""); 588 589 if (infoPtr->uNumTools == 0) 590 { 591 infoPtr->tools = COMCTL32_Alloc(sizeof(TTTOOL_INFO)); 592 toolPtr = infoPtr->tools; 593 } else 594 { 595 TTTOOL_INFO *oldTools = infoPtr->tools; 596 597 //CB: check if already exists! 598 599 infoPtr->tools = COMCTL32_Alloc (sizeof(TTTOOL_INFO)*(infoPtr->uNumTools+1)); 600 memcpy (infoPtr->tools,oldTools,infoPtr->uNumTools*sizeof(TTTOOL_INFO)); 601 COMCTL32_Free(oldTools); 602 toolPtr = &infoPtr->tools[infoPtr->uNumTools]; 603 } 604 605 infoPtr->uNumTools++; 606 607 /* copy tool data */ 608 toolPtr->uFlags = lpToolInfo->uFlags; 609 toolPtr->hwnd = lpToolInfo->hwnd; 610 toolPtr->uId = lpToolInfo->uId; 611 toolPtr->rect = lpToolInfo->rect; 612 toolPtr->hinst = lpToolInfo->hinst; 613 614 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)) 615 { 616 // TRACE (tooltips, "add string id %x!\n", (int)lpToolInfo->lpszText); 617 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 618 } else if (lpToolInfo->lpszText) 619 { 620 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) 621 { 622 // TRACE (tooltips, "add CALLBACK!\n"); 623 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 624 } else 625 { 626 INT len = lstrlenA (lpToolInfo->lpszText); 627 // TRACE (tooltips, "add text \"%s\"!\n", lpToolInfo->lpszText); 628 toolPtr->lpszText = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 629 lstrcpyAtoW (toolPtr->lpszText, lpToolInfo->lpszText); 630 } 631 } else toolPtr->lpszText = NULL; 632 633 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA)) 634 toolPtr->lParam = lpToolInfo->lParam; 635 636 /* install subclassing hook */ 637 if (toolPtr->uFlags & TTF_SUBCLASS) 638 { 639 if (toolPtr->uFlags & TTF_IDISHWND) 640 { 641 LPTT_SUBCLASS_INFO lpttsi = 642 (LPTT_SUBCLASS_INFO)GetPropA((HWND)toolPtr->uId,COMCTL32_aSubclass); 643 if (lpttsi == NULL) 644 { 645 lpttsi = (LPTT_SUBCLASS_INFO)COMCTL32_Alloc(sizeof(TT_SUBCLASS_INFO)); 646 lpttsi->wpOrigProc = 647 (WNDPROC)SetWindowLongA ((HWND)toolPtr->uId, 648 GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc); 649 lpttsi->hwndToolTip = hwnd; 650 lpttsi->uRefCount++; 651 SetPropA ((HWND)toolPtr->uId,COMCTL32_aSubclass,(HANDLE)lpttsi); 652 } 653 // else 654 // WARN (tooltips, "A window tool must only be listed once!\n"); 655 } else 656 { 657 LPTT_SUBCLASS_INFO lpttsi = 658 (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass); 659 if (lpttsi == NULL) 660 { 661 lpttsi = (LPTT_SUBCLASS_INFO)COMCTL32_Alloc(sizeof(TT_SUBCLASS_INFO)); 662 lpttsi->wpOrigProc = 663 (WNDPROC)SetWindowLongA (toolPtr->hwnd, 664 GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc); 665 lpttsi->hwndToolTip = hwnd; 666 lpttsi->uRefCount++; 667 SetPropA(toolPtr->hwnd,COMCTL32_aSubclass,(HANDLE)lpttsi); 668 } else lpttsi->uRefCount++; 669 } 670 // TRACE (tooltips, "subclassing installed!\n"); 671 } 672 673 return TRUE; 674 } 675 676 677 static LRESULT 678 TOOLTIPS_AddToolW (HWND hwnd, WPARAM wParam, LPARAM lParam) 679 { 680 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); 681 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam; 682 TTTOOL_INFO *toolPtr; 683 572 684 if (lpToolInfo == NULL) 573 685 return FALSE; 574 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE A)686 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEW) 575 687 return FALSE; 576 688 … … 607 719 } 608 720 else if (lpToolInfo->lpszText) { 609 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACK A) {721 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) { 610 722 // TRACE (tooltips, "add CALLBACK!\n"); 611 723 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 612 724 } 613 725 else { 614 INT len = lstrlenA (lpToolInfo->lpszText); 615 // TRACE (tooltips, "add text \"%s\"!\n", lpToolInfo->lpszText); 726 INT len = lstrlenW (lpToolInfo->lpszText); 727 // TRACE (tooltips, "add text \"%s\"!\n", 728 // debugstr_w(lpToolInfo->lpszText)); 616 729 toolPtr->lpszText = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 617 lstrcpy AtoW (toolPtr->lpszText, lpToolInfo->lpszText);730 lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText); 618 731 } 619 732 } 620 733 621 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFO A))734 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW)) 622 735 toolPtr->lParam = lpToolInfo->lParam; 623 736 … … 665 778 666 779 static LRESULT 667 TOOLTIPS_AddToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)668 {669 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);670 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;671 TTTOOL_INFO *toolPtr;672 673 if (lpToolInfo == NULL)674 return FALSE;675 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEW)676 return FALSE;677 678 // TRACE (tooltips, "add tool (%x) %x %d%s!\n",679 // hwnd, lpToolInfo->hwnd, lpToolInfo->uId,680 // (lpToolInfo->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");681 682 if (infoPtr->uNumTools == 0) {683 infoPtr->tools = COMCTL32_Alloc (sizeof(TTTOOL_INFO));684 toolPtr = infoPtr->tools;685 }686 else {687 TTTOOL_INFO *oldTools = infoPtr->tools;688 infoPtr->tools =689 COMCTL32_Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools + 1));690 memcpy (infoPtr->tools, oldTools,691 infoPtr->uNumTools * sizeof(TTTOOL_INFO));692 COMCTL32_Free (oldTools);693 toolPtr = &infoPtr->tools[infoPtr->uNumTools];694 }695 696 infoPtr->uNumTools++;697 698 /* copy tool data */699 toolPtr->uFlags = lpToolInfo->uFlags;700 toolPtr->hwnd = lpToolInfo->hwnd;701 toolPtr->uId = lpToolInfo->uId;702 toolPtr->rect = lpToolInfo->rect;703 toolPtr->hinst = lpToolInfo->hinst;704 705 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)) {706 // TRACE (tooltips, "add string id %x!\n", (int)lpToolInfo->lpszText);707 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText;708 }709 else if (lpToolInfo->lpszText) {710 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) {711 // TRACE (tooltips, "add CALLBACK!\n");712 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;713 }714 else {715 INT len = lstrlenW (lpToolInfo->lpszText);716 // TRACE (tooltips, "add text \"%s\"!\n",717 // debugstr_w(lpToolInfo->lpszText));718 toolPtr->lpszText = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));719 lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText);720 }721 }722 723 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW))724 toolPtr->lParam = lpToolInfo->lParam;725 726 /* install subclassing hook */727 if (toolPtr->uFlags & TTF_SUBCLASS) {728 if (toolPtr->uFlags & TTF_IDISHWND) {729 LPTT_SUBCLASS_INFO lpttsi =730 (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass);731 if (lpttsi == NULL) {732 lpttsi =733 (LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO));734 lpttsi->wpOrigProc =735 (WNDPROC)SetWindowLongA ((HWND)toolPtr->uId,736 GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc);737 lpttsi->hwndToolTip = hwnd;738 lpttsi->uRefCount++;739 SetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass,740 (HANDLE)lpttsi);741 }742 // else743 // WARN (tooltips, "A window tool must only be listed once!\n");744 }745 else {746 LPTT_SUBCLASS_INFO lpttsi =747 (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass);748 if (lpttsi == NULL) {749 lpttsi =750 (LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO));751 lpttsi->wpOrigProc =752 (WNDPROC)SetWindowLongA (toolPtr->hwnd,753 GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc);754 lpttsi->hwndToolTip = hwnd;755 lpttsi->uRefCount++;756 SetPropA (toolPtr->hwnd, COMCTL32_aSubclass, (HANDLE)lpttsi);757 }758 else759 lpttsi->uRefCount++;760 }761 // TRACE (tooltips, "subclassing installed!\n");762 }763 764 return TRUE;765 }766 767 768 static LRESULT769 780 TOOLTIPS_DelToolA (HWND hwnd, WPARAM wParam, LPARAM lParam) 770 781 { … … 1401 1412 POINT pt; 1402 1413 1403 if (lParam == 0) { 1404 // ERR (tooltips, "lpMsg == NULL!\n"); 1405 return 0; 1406 } 1407 1408 switch (lpMsg->message) { 1414 if (lParam == 0) 1415 { 1416 // ERR (tooltips, "lpMsg == NULL!\n"); 1417 return 0; 1418 } 1419 1420 switch (lpMsg->message) 1421 { 1409 1422 case WM_LBUTTONDOWN: 1410 1423 case WM_LBUTTONUP: … … 1414 1427 case WM_RBUTTONUP: 1415 1428 pt = lpMsg->pt; 1416 ScreenToClient (lpMsg->hwnd,&pt);1429 ScreenToClient(lpMsg->hwnd,&pt); 1417 1430 infoPtr->nOldTool = infoPtr->nTool; 1418 infoPtr->nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lpMsg->hwnd,&pt);1431 infoPtr->nTool = TOOLTIPS_GetToolFromPoint(infoPtr,lpMsg->hwnd,&pt); 1419 1432 // TRACE (tooltips, "tool (%x) %d %d\n", 1420 1433 // hwnd, infoPtr->nOldTool, infoPtr->nTool); … … 1424 1437 case WM_MOUSEMOVE: 1425 1438 pt = lpMsg->pt; 1426 ScreenToClient (lpMsg->hwnd,&pt);1439 ScreenToClient(lpMsg->hwnd,&pt); 1427 1440 infoPtr->nOldTool = infoPtr->nTool; 1428 infoPtr->nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lpMsg->hwnd,&pt);1441 infoPtr->nTool = TOOLTIPS_GetToolFromPoint(infoPtr,lpMsg->hwnd,&pt); 1429 1442 // TRACE (tooltips, "tool (%x) %d %d\n", 1430 1443 // hwnd, infoPtr->nOldTool, infoPtr->nTool); 1431 1444 // TRACE (tooltips, "WM_MOUSEMOVE (%04x %ld %ld)\n", 1432 1445 // hwnd, pt.x, pt.y); 1433 if ((infoPtr->bActive) && (infoPtr->nTool != infoPtr->nOldTool)) { 1434 if (infoPtr->nOldTool == -1) { 1435 SetTimer (hwnd, ID_TIMERSHOW, infoPtr->nInitialTime, 0); 1436 // TRACE (tooltips, "timer 1 started!\n"); 1437 } 1438 else { 1439 TOOLTIPS_Hide (hwnd, infoPtr); 1440 SetTimer (hwnd, ID_TIMERSHOW, infoPtr->nReshowTime, 0); 1441 // TRACE (tooltips, "timer 2 started!\n"); 1442 } 1446 infoPtr->bActive = TRUE;//CB: somewhere reset, find it!!! 1447 if (infoPtr->bActive && (infoPtr->nTool != infoPtr->nOldTool)) 1448 { 1449 if (infoPtr->nOldTool == -1) 1450 { 1451 SetTimer(hwnd,ID_TIMERSHOW,infoPtr->nInitialTime,0); 1452 // TRACE (tooltips, "timer 1 started!\n"); 1453 } else 1454 { 1455 TOOLTIPS_Hide(hwnd,infoPtr); 1456 SetTimer (hwnd,ID_TIMERSHOW,infoPtr->nReshowTime,0); 1457 // TRACE (tooltips, "timer 2 started!\n"); 1458 } 1443 1459 } 1444 if (infoPtr->nCurrentTool != -1) { 1445 SetTimer (hwnd, ID_TIMERLEAVE, 100, 0); 1446 // TRACE (tooltips, "timer 3 started!\n"); 1460 if (infoPtr->nCurrentTool != -1) 1461 { 1462 SetTimer(hwnd,ID_TIMERLEAVE,100,0); 1463 // TRACE (tooltips, "timer 3 started!\n"); 1447 1464 } 1448 1465 break; … … 1655 1672 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam; 1656 1673 1657 if (lpToolInfo == NULL) 1658 return 0;1659 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) 1660 return FALSE;1661 1662 if ((BOOL)wParam) {1663 /* activate */1664 infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);1665 if (infoPtr->nTrackTool != -1){1666 // 1667 1668 TOOLTIPS_TrackShow (hwnd,infoPtr);1669 1670 } 1671 else{1672 1673 TOOLTIPS_TrackHide (hwnd,infoPtr);1674 1675 1676 1674 if (lpToolInfo == NULL) return 0; 1675 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) return FALSE; 1676 1677 if ((BOOL)wParam) 1678 { 1679 /* activate */ 1680 infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoA(infoPtr,lpToolInfo); 1681 if (infoPtr->nTrackTool != -1) 1682 { 1683 // TRACE (tooltips, "activated!\n"); 1684 infoPtr->bTrackActive = TRUE; 1685 TOOLTIPS_TrackShow(hwnd,infoPtr); 1686 } 1687 } else 1688 { 1689 /* deactivate */ 1690 TOOLTIPS_TrackHide(hwnd,infoPtr); 1691 1692 infoPtr->bTrackActive = FALSE; 1693 infoPtr->nTrackTool = -1; 1677 1694 1678 1695 // TRACE (tooltips, "deactivated!\n"); … … 1691 1708 infoPtr->yTrackPos = (INT)HIWORD(lParam); 1692 1709 1693 if (infoPtr->bTrackActive) { 1710 if (infoPtr->bTrackActive) 1711 { 1694 1712 // TRACE (tooltips, "[%d %d]\n", 1695 1713 // infoPtr->xTrackPos, infoPtr->yTrackPos); 1696 1714 1697 TOOLTIPS_TrackShow (hwnd,infoPtr);1715 TOOLTIPS_TrackShow(hwnd,infoPtr); 1698 1716 } 1699 1717 … … 1722 1740 INT nTool; 1723 1741 1724 if (lpToolInfo == NULL) 1725 return 0; 1726 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) 1727 return FALSE; 1728 1729 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); 1742 if (lpToolInfo == NULL) return 0; 1743 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) return FALSE; 1744 1745 nTool = TOOLTIPS_GetToolFromInfoA(infoPtr,lpToolInfo); 1730 1746 if (nTool == -1) return 0; 1731 1747 … … 1737 1753 toolPtr->hinst = lpToolInfo->hinst; 1738 1754 1739 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){ 1740 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 1741 } 1742 else if (lpToolInfo->lpszText) { 1743 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) 1744 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1745 else { 1746 if (toolPtr->lpszText) { 1747 COMCTL32_Free (toolPtr->lpszText); 1748 toolPtr->lpszText = NULL; 1749 } 1750 if (lpToolInfo->lpszText) { 1751 INT len = lstrlenA (lpToolInfo->lpszText); 1752 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1753 lstrcpyAtoW (toolPtr->lpszText, lpToolInfo->lpszText); 1754 } 1755 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)) 1756 { 1757 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 1758 } else if (lpToolInfo->lpszText) 1759 { 1760 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1761 else 1762 { 1763 if (toolPtr->lpszText) 1764 { 1765 COMCTL32_Free(toolPtr->lpszText); 1766 toolPtr->lpszText = NULL; 1755 1767 } 1768 if (lpToolInfo->lpszText) 1769 { 1770 INT len = lstrlenA(lpToolInfo->lpszText); 1771 toolPtr->lpszText = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 1772 lstrcpyAtoW(toolPtr->lpszText,lpToolInfo->lpszText); 1773 } 1774 } 1756 1775 } 1757 1776 1758 1777 /* force repaint */ 1759 if (infoPtr->bActive) 1760 TOOLTIPS_Show (hwnd, infoPtr); 1761 else if (infoPtr->bTrackActive) 1762 TOOLTIPS_TrackShow (hwnd, infoPtr); 1778 if (infoPtr->bActive) TOOLTIPS_Show(hwnd,infoPtr); 1779 else if (infoPtr->bTrackActive) TOOLTIPS_TrackShow(hwnd,infoPtr); 1763 1780 1764 1781 return 0; … … 1835 1852 1836 1853 /* allocate memory for info structure */ 1837 infoPtr = (TOOLTIPS_INFO *)COMCTL32_Alloc 1838 SetWindowLongA (hwnd, 0,(DWORD)infoPtr);1854 infoPtr = (TOOLTIPS_INFO *)COMCTL32_Alloc(sizeof(TOOLTIPS_INFO)); 1855 SetWindowLongA(hwnd,0,(DWORD)infoPtr); 1839 1856 1840 1857 /* initialize info structure */ 1841 1858 infoPtr->bActive = TRUE; 1842 1859 infoPtr->bTrackActive = FALSE; 1843 infoPtr->clrBk = GetSysColor (COLOR_INFOBK);1844 infoPtr->clrText = GetSysColor (COLOR_INFOTEXT);1860 infoPtr->clrBk = RGB(0,0,0);//GetSysColor(COLOR_INFOBK);//CB: to change 1861 infoPtr->clrText = RGB(255,255,255);//GetSysColor(COLOR_INFOTEXT);//CB: to change 1845 1862 1846 1863 nclm.cbSize = sizeof(NONCLIENTMETRICSA); 1847 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm,0);1848 infoPtr->hFont = CreateFontIndirectA 1864 SystemParametersInfoA(SPI_GETNONCLIENTMETRICS,0,&nclm,0); 1865 infoPtr->hFont = CreateFontIndirectA(&nclm.lfStatusFont); 1849 1866 1850 1867 infoPtr->nMaxTipWidth = -1; … … 1859 1876 infoPtr->nInitialTime = 500; 1860 1877 1861 nResult = (INT) SendMessageA (GetParent (hwnd), WM_NOTIFYFORMAT, 1862 (WPARAM)hwnd, (LPARAM)NF_QUERY); 1878 SetRectEmpty(&infoPtr->rcMargin); 1879 1880 nResult = (INT)SendMessageA(GetParent(hwnd),WM_NOTIFYFORMAT,(WPARAM)hwnd,(LPARAM)NF_QUERY); 1863 1881 // if (nResult == NFR_ANSI) 1864 1882 // TRACE (tooltips, " -- WM_NOTIFYFORMAT returns: NFR_ANSI\n"); … … 1868 1886 // FIXME (tooltips, " -- WM_NOTIFYFORMAT returns: error!\n"); 1869 1887 1870 SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);1888 SetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE); 1871 1889 1872 1890 return 0; … … 1877 1895 TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 1878 1896 { 1879 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr 1897 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd); 1880 1898 TTTOOL_INFO *toolPtr; 1881 1899 INT i; 1882 1900 1883 1901 /* free tools */ 1884 if (infoPtr->tools) { 1885 for (i = 0; i < infoPtr->uNumTools; i++) { 1886 toolPtr = &infoPtr->tools[i]; 1887 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 1888 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) 1889 COMCTL32_Free (toolPtr->lpszText); 1890 } 1891 1892 /* remove subclassing */ 1893 if (toolPtr->uFlags & TTF_SUBCLASS) { 1894 LPTT_SUBCLASS_INFO lpttsi; 1895 1896 if (toolPtr->uFlags & TTF_IDISHWND) 1897 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1898 else 1899 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass); 1900 1901 if (lpttsi) { 1902 SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC, 1903 (LONG)lpttsi->wpOrigProc); 1904 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1905 COMCTL32_Free (&lpttsi); 1906 } 1907 } 1902 if (infoPtr->tools) 1903 { 1904 for (i = 0;i < infoPtr->uNumTools;i++) 1905 { 1906 toolPtr = &infoPtr->tools[i]; 1907 if ((toolPtr->hinst) && (toolPtr->lpszText)) 1908 { 1909 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(toolPtr->lpszText); 1908 1910 } 1909 COMCTL32_Free (infoPtr->tools); 1911 1912 /* remove subclassing */ 1913 if (toolPtr->uFlags & TTF_SUBCLASS) 1914 { 1915 LPTT_SUBCLASS_INFO lpttsi; 1916 1917 if (toolPtr->uFlags & TTF_IDISHWND) 1918 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA((HWND)toolPtr->uId,COMCTL32_aSubclass); 1919 else 1920 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA(toolPtr->hwnd,COMCTL32_aSubclass); 1921 1922 if (lpttsi) 1923 { 1924 SetWindowLongA ((HWND)toolPtr->uId,GWL_WNDPROC,(LONG)lpttsi->wpOrigProc); 1925 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1926 COMCTL32_Free (&lpttsi); 1927 } 1928 } 1929 } 1930 COMCTL32_Free (infoPtr->tools); 1910 1931 } 1911 1932 … … 1914 1935 1915 1936 /* free tool tips info data */ 1916 COMCTL32_Free 1937 COMCTL32_Free(infoPtr); 1917 1938 1918 1939 return 0; … … 1959 1980 TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) 1960 1981 { 1961 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 1982 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 1983 DWORD dwExStyle = GetWindowLongA(hwnd,GWL_EXSTYLE); 1962 1984 1963 1985 dwStyle &= 0x0000FFFF; 1964 1986 dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS); 1965 SetWindowLongA (hwnd, GWL_STYLE, dwStyle); 1987 SetWindowLongA(hwnd,GWL_STYLE,dwStyle); 1988 1989 SetWindowLongA(hwnd,GWL_EXSTYLE,dwExStyle | WS_EX_TOOLWINDOW); 1966 1990 1967 1991 return TRUE; … … 2073 2097 switch (wParam) 2074 2098 { 2075 case ID_TIMERSHOW: 2076 KillTimer (hwnd, ID_TIMERSHOW); 2077 if (TOOLTIPS_CheckTool (hwnd, TRUE) == infoPtr->nTool) 2078 TOOLTIPS_Show (hwnd, infoPtr); 2079 break; 2080 2081 case ID_TIMERPOP: 2082 TOOLTIPS_Hide (hwnd, infoPtr); 2083 break; 2084 2085 case ID_TIMERLEAVE: 2086 KillTimer (hwnd, ID_TIMERLEAVE); 2087 if (TOOLTIPS_CheckTool (hwnd, FALSE) == -1) { 2088 infoPtr->nTool = -1; 2089 infoPtr->nOldTool = -1; 2090 TOOLTIPS_Hide (hwnd, infoPtr); 2091 } 2092 break; 2099 case ID_TIMERSHOW: 2100 KillTimer (hwnd,ID_TIMERSHOW); 2101 if (TOOLTIPS_CheckTool(hwnd,TRUE) == infoPtr->nTool) 2102 TOOLTIPS_Show(hwnd,infoPtr); 2103 break; 2104 2105 case ID_TIMERPOP: 2106 TOOLTIPS_Hide (hwnd, infoPtr); 2107 break; 2108 2109 case ID_TIMERLEAVE: 2110 KillTimer (hwnd,ID_TIMERLEAVE); 2111 if (TOOLTIPS_CheckTool(hwnd,FALSE) == -1) 2112 { 2113 infoPtr->nTool = -1; 2114 infoPtr->nOldTool = -1; 2115 TOOLTIPS_Hide(hwnd,infoPtr); 2116 } 2117 break; 2093 2118 } 2094 2119 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.