Mercurial > dwindows
comparison os2/dw.c @ 1394:a151d45a7041
Added generic tooltip support on OS/2.
Will be modifying the behavior shortly to delay tooltip display...
and after a time remove the tooltip... so it acts like the other platforms.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 27 Nov 2011 09:03:26 +0000 |
parents | eb83c9830dfa |
children | e0a66f06501c |
comparison
equal
deleted
inserted
replaced
1393:eb83c9830dfa | 1394:a151d45a7041 |
---|---|
1612 GpiMove(hpsPaint, &ptl1); | 1612 GpiMove(hpsPaint, &ptl1); |
1613 GpiLine(hpsPaint, &ptl2); | 1613 GpiLine(hpsPaint, &ptl2); |
1614 } | 1614 } |
1615 | 1615 |
1616 | 1616 |
1617 /* Function: BubbleProc | |
1618 * Abstract: Subclass procedure for bubble help | |
1619 */ | |
1620 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1621 { | |
1622 MRESULT res; | |
1623 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | |
1624 | |
1625 if(proc) | |
1626 res = proc(hwnd, msg, mp1, mp2); | |
1627 else | |
1628 res = WinDefWindowProc(hwnd, msg, mp1, mp2); | |
1629 | |
1630 if(msg == WM_PAINT) | |
1631 { | |
1632 POINTL ptl; | |
1633 HPS hpsTemp; | |
1634 RECTL rcl; | |
1635 int height, width; | |
1636 | |
1637 WinQueryWindowRect(hwnd, &rcl); | |
1638 height = rcl.yTop - rcl.yBottom - 1; | |
1639 width = rcl.xRight - rcl.xLeft - 1; | |
1640 | |
1641 /* Draw a border around the bubble help */ | |
1642 hpsTemp = WinGetPS(hwnd); | |
1643 GpiSetColor(hpsTemp, CLR_BLACK); | |
1644 ptl.x = ptl.y = 0; | |
1645 GpiMove(hpsTemp, &ptl); | |
1646 ptl.x = 0; | |
1647 ptl.y = height; | |
1648 GpiLine(hpsTemp, &ptl); | |
1649 ptl.x = ptl.y = 0; | |
1650 GpiMove(hpsTemp, &ptl); | |
1651 ptl.y = 0; | |
1652 ptl.x = width; | |
1653 GpiLine(hpsTemp, &ptl); | |
1654 ptl.x = width; | |
1655 ptl.y = height; | |
1656 GpiMove(hpsTemp, &ptl); | |
1657 ptl.x = 0; | |
1658 ptl.y = height; | |
1659 GpiLine(hpsTemp, &ptl); | |
1660 ptl.x = width; | |
1661 ptl.y = height; | |
1662 GpiMove(hpsTemp, &ptl); | |
1663 ptl.y = 0; | |
1664 ptl.x = width; | |
1665 GpiLine(hpsTemp, &ptl); | |
1666 WinReleasePS(hpsTemp); | |
1667 } | |
1668 return res; | |
1669 } | |
1670 | |
1671 /* Function to handle tooltip messages from a variety of procedures */ | |
1672 MRESULT EXPENTRY _TooltipProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, WindowData *blah) | |
1673 { | |
1674 switch(msg) | |
1675 { | |
1676 case 0x041f: | |
1677 if (hwndBubble) | |
1678 { | |
1679 WinDestroyWindow(hwndBubble); | |
1680 hwndBubble = 0; | |
1681 } | |
1682 break; | |
1683 | |
1684 case 0x041e: | |
1685 | |
1686 if(!*blah->bubbletext) | |
1687 break; | |
1688 | |
1689 if(hwndBubble) | |
1690 { | |
1691 WinDestroyWindow(hwndBubble); | |
1692 hwndBubble = 0; | |
1693 } | |
1694 | |
1695 if(!hwndBubble) | |
1696 { | |
1697 HPS hpsTemp = 0; | |
1698 LONG lHight; | |
1699 LONG lWidth; | |
1700 POINTL txtPointl[TXTBOX_COUNT]; | |
1701 POINTL ptlWork = {0,0}; | |
1702 ULONG ulColor = CLR_YELLOW; | |
1703 void *bubbleproc; | |
1704 | |
1705 hwndBubbleLast = hwnd; | |
1706 hwndBubble = WinCreateWindow(HWND_DESKTOP, | |
1707 WC_STATIC, | |
1708 NULL, | |
1709 SS_TEXT | | |
1710 DT_CENTER | | |
1711 DT_VCENTER, | |
1712 0,0,0,0, | |
1713 HWND_DESKTOP, | |
1714 HWND_TOP, | |
1715 0, | |
1716 NULL, | |
1717 NULL); | |
1718 | |
1719 WinSetPresParam(hwndBubble, | |
1720 PP_FONTNAMESIZE, | |
1721 strlen(DefaultFont)+1, | |
1722 DefaultFont); | |
1723 | |
1724 | |
1725 WinSetPresParam(hwndBubble, | |
1726 PP_BACKGROUNDCOLORINDEX, | |
1727 sizeof(ulColor), | |
1728 &ulColor); | |
1729 | |
1730 WinSetWindowText(hwndBubble, | |
1731 (PSZ)blah->bubbletext); | |
1732 | |
1733 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | |
1734 | |
1735 hpsTemp = WinGetPS(hwndBubble); | |
1736 GpiQueryTextBox(hpsTemp, | |
1737 strlen(blah->bubbletext), | |
1738 (PCH)blah->bubbletext, | |
1739 TXTBOX_COUNT, | |
1740 txtPointl); | |
1741 WinReleasePS(hpsTemp); | |
1742 | |
1743 lWidth = txtPointl[TXTBOX_TOPRIGHT].x - | |
1744 txtPointl[TXTBOX_TOPLEFT ].x + 8; | |
1745 | |
1746 lHight = txtPointl[TXTBOX_TOPLEFT].y - | |
1747 txtPointl[TXTBOX_BOTTOMLEFT].y + 8; | |
1748 | |
1749 ptlWork.y -= lHight; | |
1750 | |
1751 bubbleproc = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | |
1752 | |
1753 if(bubbleproc) | |
1754 WinSetWindowPtr(hwndBubble, QWP_USER, bubbleproc); | |
1755 | |
1756 WinSetWindowPos(hwndBubble, | |
1757 HWND_TOP, | |
1758 ptlWork.x, | |
1759 ptlWork.y, | |
1760 lWidth, | |
1761 lHight, | |
1762 SWP_SIZE | SWP_MOVE | SWP_SHOW); | |
1763 } | |
1764 break; | |
1765 } | |
1766 } | |
1767 | |
1617 #define CALENDAR_BORDER 3 | 1768 #define CALENDAR_BORDER 3 |
1618 #define CALENDAR_ARROW 8 | 1769 #define CALENDAR_ARROW 8 |
1619 | 1770 |
1620 /* Returns a rectangle for a single day on the calendar */ | 1771 /* Returns a rectangle for a single day on the calendar */ |
1621 RECTL _CalendarDayRect(int position, RECTL rclPaint) | 1772 RECTL _CalendarDayRect(int position, RECTL rclPaint) |
1650 PFNWP oldproc = 0; | 1801 PFNWP oldproc = 0; |
1651 | 1802 |
1652 if(blah) | 1803 if(blah) |
1653 { | 1804 { |
1654 oldproc = blah->oldproc; | 1805 oldproc = blah->oldproc; |
1806 | |
1807 if(blah->bubbletext[0]) | |
1808 _TooltipProc(hWnd, msg, mp1, mp2, blah); | |
1655 | 1809 |
1656 switch(msg) | 1810 switch(msg) |
1657 { | 1811 { |
1658 case WM_BUTTON1DOWN: | 1812 case WM_BUTTON1DOWN: |
1659 case WM_BUTTON2DOWN: | 1813 case WM_BUTTON2DOWN: |
1886 | 2040 |
1887 | 2041 |
1888 /* This procedure handles drawing of a status border */ | 2042 /* This procedure handles drawing of a status border */ |
1889 MRESULT EXPENTRY _statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2043 MRESULT EXPENTRY _statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1890 { | 2044 { |
1891 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); | 2045 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2046 PFNWP oldproc = 0; | |
1892 | 2047 |
1893 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2)) | 2048 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2)) |
1894 return MPFROMSHORT(FALSE); | 2049 return MPFROMSHORT(FALSE); |
1895 | 2050 |
1896 if(blah && *blah) | 2051 if(blah) |
1897 { | 2052 { |
1898 PFNWP myfunc = *blah; | 2053 oldproc = blah->oldproc; |
2054 | |
2055 if(blah->bubbletext[0]) | |
2056 _TooltipProc(hWnd, msg, mp1, mp2, blah); | |
2057 | |
2058 if(blah->bubbletext[0]) | |
2059 _TooltipProc(hWnd, msg, mp1, mp2, blah); | |
1899 | 2060 |
1900 switch(msg) | 2061 switch(msg) |
1901 { | 2062 { |
1902 case WM_PAINT: | 2063 case WM_PAINT: |
1903 { | 2064 { |
1928 WinEndPaint(hpsPaint); | 2089 WinEndPaint(hpsPaint); |
1929 | 2090 |
1930 return (MRESULT)TRUE; | 2091 return (MRESULT)TRUE; |
1931 } | 2092 } |
1932 } | 2093 } |
1933 return myfunc(hWnd, msg, mp1, mp2); | 2094 if(oldproc) |
2095 return oldproc(hWnd, msg, mp1, mp2); | |
1934 } | 2096 } |
1935 | 2097 |
1936 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 2098 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
1937 } | 2099 } |
1938 | 2100 |
2093 if(blah) | 2255 if(blah) |
2094 oldproc = blah->oldproc; | 2256 oldproc = blah->oldproc; |
2095 | 2257 |
2096 WinQueryClassName(hWnd, 99, (PCH)tmpbuf); | 2258 WinQueryClassName(hWnd, 99, (PCH)tmpbuf); |
2097 | 2259 |
2260 if(blah && blah->bubbletext[0]) | |
2261 _TooltipProc(hWnd, msg, mp1, mp2, blah); | |
2262 | |
2098 /* These are the window classes which should get a menu */ | 2263 /* These are the window classes which should get a menu */ |
2099 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ | 2264 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ |
2100 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */ | 2265 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */ |
2101 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */ | 2266 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */ |
2102 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */ | 2267 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */ |
2249 /* Deal with combobox specifics and enhancements */ | 2414 /* Deal with combobox specifics and enhancements */ |
2250 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2415 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2251 { | 2416 { |
2252 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 2417 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2253 | 2418 |
2419 if(blah && blah->bubbletext[0]) | |
2420 _TooltipProc(hWnd, msg, mp1, mp2, blah); | |
2421 | |
2254 switch(msg) | 2422 switch(msg) |
2255 { | 2423 { |
2256 case WM_MOUSEMOVE: | 2424 case WM_MOUSEMOVE: |
2257 if(_wndproc(hWnd, msg, mp1, mp2)) | 2425 if(_wndproc(hWnd, msg, mp1, mp2)) |
2258 return MPFROMSHORT(FALSE); | 2426 return MPFROMSHORT(FALSE); |
2302 PFNWP oldproc = 0; | 2470 PFNWP oldproc = 0; |
2303 | 2471 |
2304 if(blah) | 2472 if(blah) |
2305 oldproc = blah->oldproc; | 2473 oldproc = blah->oldproc; |
2306 | 2474 |
2475 if(blah && blah->bubbletext[0]) | |
2476 _TooltipProc(hWnd, msg, mp1, mp2, blah); | |
2477 | |
2307 switch(msg) | 2478 switch(msg) |
2308 { | 2479 { |
2309 case WM_MOUSEMOVE: | 2480 case WM_MOUSEMOVE: |
2310 if(_wndproc(hWnd, msg, mp1, mp2)) | 2481 if(_wndproc(hWnd, msg, mp1, mp2)) |
2311 return MPFROMSHORT(FALSE); | 2482 return MPFROMSHORT(FALSE); |
2350 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 2521 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2351 PFNWP oldproc = 0; | 2522 PFNWP oldproc = 0; |
2352 | 2523 |
2353 if(blah) | 2524 if(blah) |
2354 oldproc = blah->oldproc; | 2525 oldproc = blah->oldproc; |
2526 | |
2527 if(blah && blah->bubbletext[0]) | |
2528 _TooltipProc(hWnd, msg, mp1, mp2, blah); | |
2355 | 2529 |
2356 switch(msg) | 2530 switch(msg) |
2357 { | 2531 { |
2358 case WM_MOUSEMOVE: | 2532 case WM_MOUSEMOVE: |
2359 if(_wndproc(hWnd, msg, mp1, mp2)) | 2533 if(_wndproc(hWnd, msg, mp1, mp2)) |
2381 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER); | 2555 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
2382 PFNWP oldproc = 0; | 2556 PFNWP oldproc = 0; |
2383 | 2557 |
2384 if(blah) | 2558 if(blah) |
2385 oldproc = blah->oldproc; | 2559 oldproc = blah->oldproc; |
2560 | |
2561 if(blah && blah->bubbletext[0]) | |
2562 _TooltipProc(hWnd, msg, mp1, mp2, blah); | |
2386 | 2563 |
2387 switch(msg) | 2564 switch(msg) |
2388 { | 2565 { |
2389 case WM_MOUSEMOVE: | 2566 case WM_MOUSEMOVE: |
2390 if(_wndproc(hWnd, msg, mp1, mp2)) | 2567 if(_wndproc(hWnd, msg, mp1, mp2)) |
3536 return MRFROMSHORT(FALSE); | 3713 return MRFROMSHORT(FALSE); |
3537 } | 3714 } |
3538 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 3715 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
3539 } | 3716 } |
3540 | 3717 |
3541 /* Function: BubbleProc | |
3542 * Abstract: Subclass procedure for bubble help | |
3543 */ | |
3544 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
3545 { | |
3546 MRESULT res; | |
3547 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | |
3548 | |
3549 if(proc) | |
3550 res = proc(hwnd, msg, mp1, mp2); | |
3551 else | |
3552 res = WinDefWindowProc(hwnd, msg, mp1, mp2); | |
3553 | |
3554 if(msg == WM_PAINT) | |
3555 { | |
3556 POINTL ptl; | |
3557 HPS hpsTemp; | |
3558 RECTL rcl; | |
3559 int height, width; | |
3560 | |
3561 WinQueryWindowRect(hwnd, &rcl); | |
3562 height = rcl.yTop - rcl.yBottom - 1; | |
3563 width = rcl.xRight - rcl.xLeft - 1; | |
3564 | |
3565 /* Draw a border around the bubble help */ | |
3566 hpsTemp = WinGetPS(hwnd); | |
3567 GpiSetColor(hpsTemp, CLR_BLACK); | |
3568 ptl.x = ptl.y = 0; | |
3569 GpiMove(hpsTemp, &ptl); | |
3570 ptl.x = 0; | |
3571 ptl.y = height; | |
3572 GpiLine(hpsTemp, &ptl); | |
3573 ptl.x = ptl.y = 0; | |
3574 GpiMove(hpsTemp, &ptl); | |
3575 ptl.y = 0; | |
3576 ptl.x = width; | |
3577 GpiLine(hpsTemp, &ptl); | |
3578 ptl.x = width; | |
3579 ptl.y = height; | |
3580 GpiMove(hpsTemp, &ptl); | |
3581 ptl.x = 0; | |
3582 ptl.y = height; | |
3583 GpiLine(hpsTemp, &ptl); | |
3584 ptl.x = width; | |
3585 ptl.y = height; | |
3586 GpiMove(hpsTemp, &ptl); | |
3587 ptl.y = 0; | |
3588 ptl.x = width; | |
3589 GpiLine(hpsTemp, &ptl); | |
3590 WinReleasePS(hpsTemp); | |
3591 } | |
3592 return res; | |
3593 } | |
3594 | |
3595 MRESULT EXPENTRY _button_draw(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, PFNWP oldproc, int indent) | 3718 MRESULT EXPENTRY _button_draw(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, PFNWP oldproc, int indent) |
3596 { | 3719 { |
3597 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap"); | 3720 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap"); |
3598 HPIXMAP disable = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap_disabled"); | 3721 HPIXMAP disable = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap_disabled"); |
3599 HPOINTER icon = (HPOINTER)dw_window_get_data(hwnd, "_dw_button_icon"); | 3722 HPOINTER icon = (HPOINTER)dw_window_get_data(hwnd, "_dw_button_icon"); |
3674 | 3797 |
3675 if(!blah) | 3798 if(!blah) |
3676 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 3799 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
3677 | 3800 |
3678 oldproc = blah->oldproc; | 3801 oldproc = blah->oldproc; |
3802 | |
3803 if(blah->bubbletext[0]) | |
3804 _TooltipProc(hwnd, msg, mp1, mp2, blah); | |
3679 | 3805 |
3680 switch(msg) | 3806 switch(msg) |
3681 { | 3807 { |
3682 case WM_MOUSEMOVE: | 3808 case WM_MOUSEMOVE: |
3683 if(_wndproc(hwnd, msg, mp1, mp2)) | 3809 if(_wndproc(hwnd, msg, mp1, mp2)) |
3799 _shift_focus(hwnd); | 3925 _shift_focus(hwnd); |
3800 return FALSE; | 3926 return FALSE; |
3801 } | 3927 } |
3802 } | 3928 } |
3803 break; | 3929 break; |
3804 case 0x041f: | 3930 } |
3805 if (hwndBubble) | |
3806 { | |
3807 WinDestroyWindow(hwndBubble); | |
3808 hwndBubble = 0; | |
3809 } | |
3810 break; | |
3811 | |
3812 case 0x041e: | |
3813 | |
3814 if(!*blah->bubbletext) | |
3815 break; | |
3816 | |
3817 if(hwndBubble) | |
3818 { | |
3819 WinDestroyWindow(hwndBubble); | |
3820 hwndBubble = 0; | |
3821 } | |
3822 | |
3823 if(!hwndBubble) | |
3824 { | |
3825 HPS hpsTemp = 0; | |
3826 LONG lHight; | |
3827 LONG lWidth; | |
3828 POINTL txtPointl[TXTBOX_COUNT]; | |
3829 POINTL ptlWork = {0,0}; | |
3830 ULONG ulColor = CLR_YELLOW; | |
3831 void *bubbleproc; | |
3832 | |
3833 hwndBubbleLast = hwnd; | |
3834 hwndBubble = WinCreateWindow(HWND_DESKTOP, | |
3835 WC_STATIC, | |
3836 NULL, | |
3837 SS_TEXT | | |
3838 DT_CENTER | | |
3839 DT_VCENTER, | |
3840 0,0,0,0, | |
3841 HWND_DESKTOP, | |
3842 HWND_TOP, | |
3843 0, | |
3844 NULL, | |
3845 NULL); | |
3846 | |
3847 WinSetPresParam(hwndBubble, | |
3848 PP_FONTNAMESIZE, | |
3849 strlen(DefaultFont)+1, | |
3850 DefaultFont); | |
3851 | |
3852 | |
3853 WinSetPresParam(hwndBubble, | |
3854 PP_BACKGROUNDCOLORINDEX, | |
3855 sizeof(ulColor), | |
3856 &ulColor); | |
3857 | |
3858 WinSetWindowText(hwndBubble, | |
3859 (PSZ)blah->bubbletext); | |
3860 | |
3861 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | |
3862 | |
3863 hpsTemp = WinGetPS(hwndBubble); | |
3864 GpiQueryTextBox(hpsTemp, | |
3865 strlen(blah->bubbletext), | |
3866 (PCH)blah->bubbletext, | |
3867 TXTBOX_COUNT, | |
3868 txtPointl); | |
3869 WinReleasePS(hpsTemp); | |
3870 | |
3871 lWidth = txtPointl[TXTBOX_TOPRIGHT].x - | |
3872 txtPointl[TXTBOX_TOPLEFT ].x + 8; | |
3873 | |
3874 lHight = txtPointl[TXTBOX_TOPLEFT].y - | |
3875 txtPointl[TXTBOX_BOTTOMLEFT].y + 8; | |
3876 | |
3877 ptlWork.y -= lHight; | |
3878 | |
3879 bubbleproc = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | |
3880 | |
3881 if(bubbleproc) | |
3882 WinSetWindowPtr(hwndBubble, QWP_USER, bubbleproc); | |
3883 | |
3884 WinSetWindowPos(hwndBubble, | |
3885 HWND_TOP, | |
3886 ptlWork.x, | |
3887 ptlWork.y, | |
3888 lWidth, | |
3889 lHight, | |
3890 SWP_SIZE | SWP_MOVE | SWP_SHOW); | |
3891 } | |
3892 break; | |
3893 } | |
3894 | |
3895 if(!oldproc) | 3931 if(!oldproc) |
3896 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 3932 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
3897 return oldproc(hwnd, msg, mp1, mp2); | 3933 return oldproc(hwnd, msg, mp1, mp2); |
3898 } | 3934 } |
3899 | 3935 |
3900 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 3936 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
3901 { | 3937 { |
3902 int res = 0; | 3938 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); |
3903 res = (int)_run_event(hwnd, msg, mp1, mp2); | 3939 int res = (int)_run_event(hwnd, msg, mp1, mp2); |
3940 | |
3941 if(blah && blah->bubbletext[0]) | |
3942 _TooltipProc(hwnd, msg, mp1, mp2, blah); | |
3943 | |
3904 switch(msg) | 3944 switch(msg) |
3905 { | 3945 { |
3906 case WM_MOUSEMOVE: | 3946 case WM_MOUSEMOVE: |
3907 if(_wndproc(hwnd, msg, mp1, mp2)) | 3947 if(_wndproc(hwnd, msg, mp1, mp2)) |
3908 return MPFROMSHORT(FALSE); | 3948 return MPFROMSHORT(FALSE); |
3923 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); | 3963 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); |
3924 PFNWP oldproc = 0; | 3964 PFNWP oldproc = 0; |
3925 | 3965 |
3926 if(blah) | 3966 if(blah) |
3927 oldproc = blah->oldproc; | 3967 oldproc = blah->oldproc; |
3968 | |
3969 if(blah && blah->bubbletext[0]) | |
3970 _TooltipProc(hwnd, msg, mp1, mp2, blah); | |
3928 | 3971 |
3929 switch(msg) | 3972 switch(msg) |
3930 { | 3973 { |
3931 case WM_MOUSEMOVE: | 3974 case WM_MOUSEMOVE: |
3932 if(_wndproc(hwnd, msg, mp1, mp2)) | 3975 if(_wndproc(hwnd, msg, mp1, mp2)) |
5636 id, | 5679 id, |
5637 NULL, | 5680 NULL, |
5638 NULL); | 5681 NULL); |
5639 | 5682 |
5640 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); | 5683 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); |
5641 blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
5642 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 5684 blah->oldproc = WinSubclassWindow(tmp, _BtProc); |
5643 | 5685 |
5644 WinSetWindowPtr(tmp, QWP_USER, blah); | 5686 WinSetWindowPtr(tmp, QWP_USER, blah); |
5645 | 5687 |
5646 if(icon) | 5688 if(icon) |
5734 _foreground = fore; | 5776 _foreground = fore; |
5735 } | 5777 } |
5736 } | 5778 } |
5737 | 5779 |
5738 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); | 5780 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); |
5739 blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
5740 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 5781 blah->oldproc = WinSubclassWindow(tmp, _BtProc); |
5741 | 5782 |
5742 WinSetWindowPtr(tmp, QWP_USER, blah); | 5783 WinSetWindowPtr(tmp, QWP_USER, blah); |
5743 | 5784 |
5744 if(icon) | 5785 if(icon) |
5833 _foreground = fore; | 5874 _foreground = fore; |
5834 } | 5875 } |
5835 } | 5876 } |
5836 | 5877 |
5837 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); | 5878 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); |
5838 blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
5839 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 5879 blah->oldproc = WinSubclassWindow(tmp, _BtProc); |
5840 | 5880 |
5841 WinSetWindowPtr(tmp, QWP_USER, blah); | 5881 WinSetWindowPtr(tmp, QWP_USER, blah); |
5842 | 5882 |
5843 if(icon) | 5883 if(icon) |
5924 WindowData *blah = calloc(1, sizeof(WindowData)); | 5964 WindowData *blah = calloc(1, sizeof(WindowData)); |
5925 SLDCDATA sldcData = { 0, 0, 0, 0, 0 }; | 5965 SLDCDATA sldcData = { 0, 0, 0, 0, 0 }; |
5926 HWND tmp; | 5966 HWND tmp; |
5927 | 5967 |
5928 sldcData.cbSize = sizeof(SLDCDATA); | 5968 sldcData.cbSize = sizeof(SLDCDATA); |
5929 sldcData.usScale1Increments = increments; | 5969 sldcData.usScale1Increments = increments; |
5930 | 5970 |
5931 tmp = WinCreateWindow(HWND_OBJECT, | 5971 tmp = WinCreateWindow(HWND_OBJECT, |
5932 WC_SLIDER, | 5972 WC_SLIDER, |
5933 NULL, | 5973 NULL, |
5934 WS_VISIBLE | SLS_SNAPTOINCREMENT | | 5974 WS_VISIBLE | SLS_SNAPTOINCREMENT | |
6009 NULLHANDLE, | 6049 NULLHANDLE, |
6010 HWND_TOP, | 6050 HWND_TOP, |
6011 id, | 6051 id, |
6012 NULL, | 6052 NULL, |
6013 NULL); | 6053 NULL); |
6014 blah->bubbletext[0] = '\0'; | |
6015 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 6054 blah->oldproc = WinSubclassWindow(tmp, _BtProc); |
6016 WinSetWindowPtr(tmp, QWP_USER, blah); | 6055 WinSetWindowPtr(tmp, QWP_USER, blah); |
6017 dw_window_set_font(tmp, DefaultFont); | 6056 dw_window_set_font(tmp, DefaultFont); |
6018 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | 6057 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
6019 return tmp; | 6058 return tmp; |
6313 * handle: Handle to the window (widget). | 6352 * handle: Handle to the window (widget). |
6314 * bubbletext: The text in the floating bubble tooltip. | 6353 * bubbletext: The text in the floating bubble tooltip. |
6315 */ | 6354 */ |
6316 void API dw_window_set_tooltip(HWND handle, char *bubbletext) | 6355 void API dw_window_set_tooltip(HWND handle, char *bubbletext) |
6317 { | 6356 { |
6318 /* TODO: Fill this in with generic bubble help code... | 6357 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
6319 * like we do for the bitmap buttons. | 6358 HWND buddy = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
6320 */ | 6359 |
6360 if(blah) | |
6361 strncpy(blah->bubbletext, bubbletext, BUBBLE_HELP_MAX - 1); | |
6362 if(buddy && (blah = (WindowData *)WinQueryWindowPtr(buddy, QWP_USER))) | |
6363 strncpy(blah->bubbletext, bubbletext, BUBBLE_HELP_MAX - 1); | |
6321 } | 6364 } |
6322 | 6365 |
6323 /* | 6366 /* |
6324 * Gets the text used for a given window. | 6367 * Gets the text used for a given window. |
6325 * Parameters: | 6368 * Parameters: |