Changeset 1058 for trunk/src/comctl32/tooltips.c
- Timestamp:
- Sep 26, 1999, 1:01:11 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/tooltips.c
r496 r1058 1 /* $Id: tooltips.c,v 1.1 3 1999-08-14 16:13:15 cbratschiExp $ */1 /* $Id: tooltips.c,v 1.14 1999-09-26 11:01:11 achimha Exp $ */ 2 2 /* 3 3 * Tool tip control … … 21 21 - CS_SAVEBITS: window movements are slow, bug in Open32? 22 22 */ 23 24 /* WINE 990923 level */ 23 25 24 26 #include <string.h> … … 834 836 toolPtr = &infoPtr->tools[nTool]; 835 837 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 836 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) 838 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 839 (HIWORD((INT)toolPtr->lpszText) != 0) ) 837 840 COMCTL32_Free (toolPtr->lpszText); 838 841 } … … 891 894 toolPtr = &infoPtr->tools[nTool]; 892 895 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 893 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) 896 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 897 (HIWORD((INT)toolPtr->lpszText) != 0) ) 894 898 COMCTL32_Free (toolPtr->lpszText); 895 899 } … … 1573 1577 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1574 1578 else { 1575 if (toolPtr->lpszText) { 1579 if ( (toolPtr->lpszText) && 1580 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1576 1581 COMCTL32_Free (toolPtr->lpszText); 1577 1582 toolPtr->lpszText = NULL; … … 1627 1632 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1628 1633 else { 1629 if (toolPtr->lpszText) { 1634 if ( (toolPtr->lpszText) && 1635 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1630 1636 COMCTL32_Free (toolPtr->lpszText); 1631 1637 toolPtr->lpszText = NULL; … … 1711 1717 1712 1718 1713 static LRESULT1714 1719 TOOLTIPS_UpdateTipTextA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1715 1720 { … … 1719 1724 INT nTool; 1720 1725 1721 if (lpToolInfo == NULL) return 0; 1722 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) return FALSE; 1723 1724 nTool = TOOLTIPS_GetToolFromInfoA(infoPtr,lpToolInfo); 1726 if (lpToolInfo == NULL) 1727 return 0; 1728 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) 1729 return FALSE; 1730 1731 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); 1725 1732 if (nTool == -1) return 0; 1726 1733 1727 // TRACE (tooltips,"tool %d\n", nTool);1734 // TRACE("tool %d\n", nTool); 1728 1735 1729 1736 toolPtr = &infoPtr->tools[nTool]; … … 1732 1739 toolPtr->hinst = lpToolInfo->hinst; 1733 1740 1734 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)) 1735 { 1736 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 1737 } else if (lpToolInfo->lpszText) 1738 { 1739 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1740 else 1741 { 1742 if (toolPtr->lpszText) 1743 { 1744 COMCTL32_Free(toolPtr->lpszText); 1745 toolPtr->lpszText = NULL; 1746 } 1747 if (lpToolInfo->lpszText) 1748 { 1749 INT len = lstrlenA(lpToolInfo->lpszText); 1750 toolPtr->lpszText = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 1751 lstrcpyAtoW(toolPtr->lpszText,lpToolInfo->lpszText); 1752 } 1753 } 1741 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){ 1742 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 1743 } 1744 else if (lpToolInfo->lpszText) { 1745 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) 1746 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1747 else { 1748 if ( (toolPtr->lpszText) && 1749 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1750 COMCTL32_Free (toolPtr->lpszText); 1751 toolPtr->lpszText = NULL; 1752 } 1753 if (lpToolInfo->lpszText) { 1754 INT len = lstrlenA (lpToolInfo->lpszText); 1755 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1756 lstrcpyAtoW (toolPtr->lpszText, lpToolInfo->lpszText); 1757 } 1758 } 1754 1759 } 1755 1760 1756 1761 /* force repaint */ 1757 if (infoPtr->bActive) TOOLTIPS_Show(hwnd,infoPtr); 1758 else if (infoPtr->bTrackActive) TOOLTIPS_TrackShow(hwnd,infoPtr); 1762 if (infoPtr->bActive) 1763 TOOLTIPS_Show (hwnd, infoPtr); 1764 else if (infoPtr->bTrackActive) 1765 TOOLTIPS_TrackShow (hwnd, infoPtr); 1759 1766 1760 1767 return 0; … … 1771 1778 1772 1779 if (lpToolInfo == NULL) 1773 1780 return 0; 1774 1781 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEW) 1775 1782 return FALSE; 1776 1783 1777 1784 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo); 1778 1785 if (nTool == -1) 1779 1780 1781 // TRACE (tooltips,"tool %d\n", nTool);1786 return 0; 1787 1788 // TRACE("tool %d\n", nTool); 1782 1789 1783 1790 toolPtr = &infoPtr->tools[nTool]; … … 1787 1794 1788 1795 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){ 1789 1796 toolPtr->lpszText = lpToolInfo->lpszText; 1790 1797 } 1791 1798 else if (lpToolInfo->lpszText) { 1792 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) 1793 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1794 else { 1795 if (toolPtr->lpszText) { 1796 COMCTL32_Free (toolPtr->lpszText); 1797 toolPtr->lpszText = NULL; 1798 } 1799 if (lpToolInfo->lpszText) { 1800 INT len = lstrlenW (lpToolInfo->lpszText); 1801 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1802 lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText); 1803 } 1804 } 1799 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) 1800 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1801 else { 1802 if ( (toolPtr->lpszText) && 1803 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1804 COMCTL32_Free (toolPtr->lpszText); 1805 toolPtr->lpszText = NULL; 1806 } 1807 if (lpToolInfo->lpszText) { 1808 INT len = lstrlenW (lpToolInfo->lpszText); 1809 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1810 lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText); 1811 } 1812 } 1805 1813 } 1806 1814 1807 1815 /* force repaint */ 1808 1816 if (infoPtr->bActive) 1809 1817 TOOLTIPS_Show (hwnd, infoPtr); 1810 1818 else if (infoPtr->bTrackActive) 1811 1819 TOOLTIPS_TrackShow (hwnd, infoPtr); 1812 1820 1813 1821 return 0; … … 1882 1890 1883 1891 /* free tools */ 1884 if (infoPtr->tools) 1885 { 1886 for (i = 0;i < infoPtr->uNumTools;i++) 1887 { 1888 toolPtr = &infoPtr->tools[i]; 1889 if ((toolPtr->hinst) && (toolPtr->lpszText)) 1890 { 1891 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(toolPtr->lpszText); 1892 } 1893 1894 /* remove subclassing */ 1895 TOOLTIPS_Desubclass(toolPtr); 1896 1892 if (infoPtr->tools) { 1893 for (i = 0; i < infoPtr->uNumTools; i++) { 1894 toolPtr = &infoPtr->tools[i]; 1895 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 1896 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 1897 (HIWORD((INT)toolPtr->lpszText) != 0) ) 1898 { 1899 COMCTL32_Free (toolPtr->lpszText); 1900 toolPtr->lpszText = NULL; 1901 } 1902 } 1903 1904 /* remove subclassing */ 1905 if (toolPtr->uFlags & TTF_SUBCLASS) { 1906 LPTT_SUBCLASS_INFO lpttsi; 1907 1908 if (toolPtr->uFlags & TTF_IDISHWND) 1909 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1910 else 1911 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass); 1912 1913 if (lpttsi) { 1914 SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC, 1915 (LONG)lpttsi->wpOrigProc); 1916 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1917 COMCTL32_Free (&lpttsi); 1918 } 1919 } 1897 1920 } 1898 1921 COMCTL32_Free (infoPtr->tools);
Note:
See TracChangeset
for help on using the changeset viewer.