Changeset 2205 for trunk/src/comctl32/tooltips.c
- Timestamp:
- Dec 26, 1999, 6:32:14 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/tooltips.c
r1664 r2205 1 /* $Id: tooltips.c,v 1.1 7 1999-11-09 14:38:01 achimhaExp $ */1 /* $Id: tooltips.c,v 1.18 1999-12-26 17:32:14 cbratschi Exp $ */ 2 2 /* 3 3 * Tool tip control … … 16 16 * hittest.exe, needtext.exe, newrect.exe, updtext.exe and winfrpt.exe. 17 17 */ 18 19 /* CB: Odin32 problems20 - WM_NCCREATE not handled first -> title bar visible if WS_POPUP wasn't set before21 - CS_SAVEBITS: window movements are slow, bug in Open32?22 */23 18 24 19 /* WINE 991031 level */ … … 262 257 263 258 if (infoPtr->nMaxTipWidth > -1) { 264 265 259 rc.right = infoPtr->nMaxTipWidth; 260 uFlags |= DT_WORDBREAK; 266 261 } 267 262 if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX) 268 263 uFlags |= DT_NOPREFIX; 269 264 // TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText)); 270 265 … … 275 270 ReleaseDC (hwnd, hdc); 276 271 277 lpSize->cx = rc.right - rc.left + 4 + 278 272 lpSize->cx = rc.right - rc.left + 4 + 273 infoPtr->rcMargin.left + infoPtr->rcMargin.right; 279 274 lpSize->cy = rc.bottom - rc.top + 4 + 280 275 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top; 281 276 } 282 277 … … 291 286 292 287 if (infoPtr->nTool == -1) { 293 // 294 288 // TRACE("invalid tool (-1)!\n"); 289 return; 295 290 } 296 291 … … 302 297 303 298 if (infoPtr->szTipText[0] == L'\0') { 304 305 299 infoPtr->nCurrentTool = -1; 300 return; 306 301 } 307 302 … … 313 308 hdr.code = TTN_SHOW; 314 309 SendMessageA (toolPtr->hwnd, WM_NOTIFY, 315 310 (WPARAM)toolPtr->uId, (LPARAM)&hdr); 316 311 317 312 // TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText)); … … 321 316 322 317 if (toolPtr->uFlags & TTF_CENTERTIP) { 323 324 325 326 327 328 329 330 331 332 318 RECT rc; 319 320 if (toolPtr->uFlags & TTF_IDISHWND) 321 GetWindowRect ((HWND)toolPtr->uId, &rc); 322 else { 323 rc = toolPtr->rect; 324 MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2); 325 } 326 rect.left = (rc.left + rc.right - size.cx) / 2; 327 rect.top = rc.bottom + 2; 333 328 } 334 329 else { 335 336 330 GetCursorPos ((LPPOINT)&rect); 331 rect.top += 20; 337 332 } 338 333 … … 345 340 wndrect.right = GetSystemMetrics( SM_CXSCREEN ); 346 341 if( rect.right > wndrect.right ) { 347 348 342 rect.left -= rect.right - wndrect.right + 2; 343 rect.right = wndrect.right - 2; 349 344 } 350 345 wndrect.bottom = GetSystemMetrics( SM_CYSCREEN ); … … 352 347 RECT rc; 353 348 354 355 356 357 358 359 } 360 361 349 if (toolPtr->uFlags & TTF_IDISHWND) 350 GetWindowRect ((HWND)toolPtr->uId, &rc); 351 else { 352 rc = toolPtr->rect; 353 MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2); 354 } 355 rect.bottom = rc.top - 2; 356 rect.top = rect.bottom - size.cy; 362 357 } 363 358 364 359 AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE), 365 360 FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE)); 366 361 367 362 SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, 368 369 363 rect.right - rect.left, rect.bottom - rect.top, 364 SWP_SHOWWINDOW | SWP_NOACTIVATE); 370 365 371 366 /* repaint the tooltip */ … … 909 904 toolPtr = &infoPtr->tools[nTool]; 910 905 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 911 912 906 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 907 (HIWORD((INT)toolPtr->lpszText) != 0) ) 913 908 COMCTL32_Free (toolPtr->lpszText); 914 909 } … … 967 962 toolPtr = &infoPtr->tools[nTool]; 968 963 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 969 970 964 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 965 (HIWORD((INT)toolPtr->lpszText) != 0) ) 971 966 COMCTL32_Free (toolPtr->lpszText); 972 967 } … … 1650 1645 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1651 1646 else { 1652 1653 1647 if ( (toolPtr->lpszText) && 1648 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1654 1649 COMCTL32_Free (toolPtr->lpszText); 1655 1650 toolPtr->lpszText = NULL; … … 1705 1700 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1706 1701 else { 1707 1708 1702 if ( (toolPtr->lpszText) && 1703 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1709 1704 COMCTL32_Free (toolPtr->lpszText); 1710 1705 toolPtr->lpszText = NULL; … … 1798 1793 1799 1794 if (lpToolInfo == NULL) 1800 1795 return 0; 1801 1796 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) 1802 1797 return FALSE; 1803 1798 1804 1799 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); … … 1813 1808 1814 1809 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){ 1815 1810 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 1816 1811 } 1817 1812 else if (lpToolInfo->lpszText) { 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1813 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) 1814 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1815 else { 1816 if ( (toolPtr->lpszText) && 1817 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1818 COMCTL32_Free (toolPtr->lpszText); 1819 toolPtr->lpszText = NULL; 1820 } 1821 if (lpToolInfo->lpszText) { 1822 INT len = lstrlenA (lpToolInfo->lpszText); 1823 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1824 lstrcpyAtoW (toolPtr->lpszText, lpToolInfo->lpszText); 1825 } 1826 } 1832 1827 } 1833 1828 1834 1829 /* force repaint */ 1835 1830 if (infoPtr->bActive) 1836 1831 TOOLTIPS_Show (hwnd, infoPtr); 1837 1832 else if (infoPtr->bTrackActive) 1838 1833 TOOLTIPS_TrackShow (hwnd, infoPtr); 1839 1834 1840 1835 return 0; … … 1851 1846 1852 1847 if (lpToolInfo == NULL) 1853 1848 return 0; 1854 1849 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEW) 1855 1850 return FALSE; 1856 1851 1857 1852 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo); 1858 1853 if (nTool == -1) 1859 1854 return 0; 1860 1855 1861 1856 // TRACE("tool %d\n", nTool); … … 1867 1862 1868 1863 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){ 1869 1864 toolPtr->lpszText = lpToolInfo->lpszText; 1870 1865 } 1871 1866 else if (lpToolInfo->lpszText) { 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1867 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) 1868 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1869 else { 1870 if ( (toolPtr->lpszText) && 1871 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1872 COMCTL32_Free (toolPtr->lpszText); 1873 toolPtr->lpszText = NULL; 1874 } 1875 if (lpToolInfo->lpszText) { 1876 INT len = lstrlenW (lpToolInfo->lpszText); 1877 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1878 lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText); 1879 } 1880 } 1886 1881 } 1887 1882 1888 1883 /* force repaint */ 1889 1884 if (infoPtr->bActive) 1890 1885 TOOLTIPS_Show (hwnd, infoPtr); 1891 1886 else if (infoPtr->bTrackActive) 1892 1887 TOOLTIPS_TrackShow (hwnd, infoPtr); 1893 1888 1894 1889 return 0; … … 1964 1959 /* free tools */ 1965 1960 if (infoPtr->tools) { 1966 1967 1968 1969 1970 (HIWORD((INT)toolPtr->lpszText) != 0) ) 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1961 for (i = 0; i < infoPtr->uNumTools; i++) { 1962 toolPtr = &infoPtr->tools[i]; 1963 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 1964 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 1965 (HIWORD((INT)toolPtr->lpszText) != 0) ) 1966 { 1967 COMCTL32_Free (toolPtr->lpszText); 1968 toolPtr->lpszText = NULL; 1969 } 1970 } 1971 1972 /* remove subclassing */ 1973 if (toolPtr->uFlags & TTF_SUBCLASS) { 1974 LPTT_SUBCLASS_INFO lpttsi; 1975 1976 if (toolPtr->uFlags & TTF_IDISHWND) 1977 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1978 else 1979 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass); 1980 1981 if (lpttsi) { 1982 SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC, 1983 (LONG)lpttsi->wpOrigProc); 1984 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1985 COMCTL32_Free (&lpttsi); 1986 } 1987 } 1993 1988 } 1994 1989 COMCTL32_Free (infoPtr->tools);
Note:
See TracChangeset
for help on using the changeset viewer.