comparison os2/dw.c @ 404:720e61df8cf6

An even better combobox drawing fix. Only add 100 pixels to the size of the combobox when the list needs to be shown. This way it won't screw up clipping of items below it in the box. So OS/2 comboboxes can now be safely used in vertical boxes without worries.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 10 May 2003 10:33:54 +0000
parents a7a561103eac
children 4c084ec3e176
comparison
equal deleted inserted replaced
403:6a3ef130962f 404:720e61df8cf6
1159 WinQueryClassName(handle, 99, tmpbuf); 1159 WinQueryClassName(handle, 99, tmpbuf);
1160 1160
1161 if(strncmp(tmpbuf, "#2", 3)==0) 1161 if(strncmp(tmpbuf, "#2", 3)==0)
1162 { 1162 {
1163 /* Make the combobox big enough to drop down. :) */ 1163 /* Make the combobox big enough to drop down. :) */
1164 WinSetWindowPos(handle, HWND_TOP, currentx + pad, (currenty + pad) - 100, 1164 if(dw_window_get_data(handle, "_dw_dropped"))
1165 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); 1165 WinSetWindowPos(handle, HWND_TOP, currentx + pad, (currenty + pad) - 100,
1166 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
1167 else
1168 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
1169 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
1170
1166 } 1171 }
1167 else if(strncmp(tmpbuf, "#6", 3)==0) 1172 else if(strncmp(tmpbuf, "#6", 3)==0)
1168 { 1173 {
1169 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ 1174 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */
1170 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, 1175 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3,
1734 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); 1739 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
1735 break; 1740 break;
1736 case WM_SETFOCUS: 1741 case WM_SETFOCUS:
1737 _run_event(hWnd, msg, mp1, mp2); 1742 _run_event(hWnd, msg, mp1, mp2);
1738 break; 1743 break;
1744 case CBM_SHOWLIST:
1745 {
1746 int dropped = dw_window_get_data(hWnd, "_dw_dropped");
1747
1748 if(mp1)
1749 {
1750 if(!dropped)
1751 {
1752 SWP swp;
1753
1754 WinQueryWindowPos(hWnd, &swp);
1755 WinSetWindowPos(hWnd, NULLHANDLE, swp.x, swp.y - 100, swp.cx, swp.cy + 100, SWP_MOVE | SWP_SIZE);
1756 dw_window_set_data(hWnd, "_dw_dropped", (void *)1);
1757 }
1758 }
1759 else
1760 {
1761 if(dropped)
1762 {
1763 SWP swp;
1764
1765 WinQueryWindowPos(hWnd, &swp);
1766 WinSetWindowPos(hWnd, NULLHANDLE, swp.x, swp.y + 100, swp.cx, swp.cy - 100, SWP_MOVE | SWP_SIZE);
1767 dw_window_set_data(hWnd, "_dw_dropped", (void *)0);
1768 }
1769 }
1770 }
1771 break;
1739 case WM_PAINT: 1772 case WM_PAINT:
1740 { 1773 {
1741 HWND entry, parent = WinQueryWindow(hWnd, QW_PARENT); 1774 HWND entry, parent = WinQueryWindow(hWnd, QW_PARENT);
1742 HPS hpsPaint; 1775 HPS hpsPaint;
1743 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */ 1776 POINTL ptl;
1744 unsigned long width, height, thumbheight = 0; 1777 unsigned long width, height, thumbheight = 0;
1745 ULONG color; 1778 ULONG color;
1746 1779
1747 if((entry = (HWND)dw_window_get_data(hWnd, "_dw_comboentry")) != NULLHANDLE) 1780 if((entry = (HWND)dw_window_get_data(hWnd, "_dw_comboentry")) != NULLHANDLE)
1748 dw_window_get_pos_size(entry, 0, 0, 0, &thumbheight); 1781 dw_window_get_pos_size(entry, 0, 0, 0, &thumbheight);
1749 1782
1750 if(!thumbheight) 1783 if(!thumbheight)
1751 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW); 1784 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW);
1752 1785
1786 /* Add 6 because it has a thick border like the entryfield */
1753 thumbheight += 6; 1787 thumbheight += 6;
1754 1788
1755 color = (ULONG)dw_window_get_data(parent, "_dw_fore"); 1789 color = (ULONG)dw_window_get_data(parent, "_dw_fore");
1756 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); 1790 dw_window_get_pos_size(hWnd, 0, 0, &width, &height);
1757 1791
1758 hpsPaint = WinGetPS(hWnd); 1792 if(height > thumbheight)
1759 if(color) 1793 {
1760 GpiSetColor(hpsPaint, _internal_color(color-1)); 1794 hpsPaint = WinGetPS(hWnd);
1761 else 1795 if(color)
1762 GpiSetColor(hpsPaint, CLR_PALEGRAY); 1796 GpiSetColor(hpsPaint, _internal_color(color-1));
1763 1797 else
1764 ptl.x = 0; 1798 GpiSetColor(hpsPaint, CLR_PALEGRAY);
1765 ptl.y = 96; 1799
1766 GpiMove(hpsPaint, &ptl); 1800 ptl.x = ptl.y = 0;
1767 1801 GpiMove(hpsPaint, &ptl);
1768 ptl.x = width; 1802
1769 ptl.y = height - thumbheight; 1803 ptl.x = width;
1770 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0); 1804 ptl.y = height - thumbheight;
1771 1805 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
1772 WinReleasePS(hpsPaint); 1806
1807 WinReleasePS(hpsPaint);
1808 }
1773 } 1809 }
1774 break; 1810 break;
1775 } 1811 }
1776 if(oldproc) 1812 if(oldproc)
1777 return oldproc(hWnd, msg, mp1, mp2); 1813 return oldproc(hWnd, msg, mp1, mp2);
2499 case WM_CLOSE: 2535 case WM_CLOSE:
2500 if(result == -1) 2536 if(result == -1)
2501 { 2537 {
2502 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT)); 2538 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT));
2503 return (MRESULT)TRUE; 2539 return (MRESULT)TRUE;
2540 }
2541 break;
2542 case WM_MOUSEMOVE:
2543 {
2544 HPOINTER ptr = (HPOINTER)dw_window_get_data(hWnd, "_dw_pointer");
2545
2546 if(ptr)
2547 WinSetPointer(HWND_DESKTOP, ptr);
2504 } 2548 }
2505 break; 2549 break;
2506 case WM_USER: 2550 case WM_USER:
2507 windowfunc = (void (* API)(void *))mp1; 2551 windowfunc = (void (* API)(void *))mp1;
2508 2552
3617 * handle: Handle to widget for which to change. 3661 * handle: Handle to widget for which to change.
3618 * cursortype: ID of the pointer you want. 3662 * cursortype: ID of the pointer you want.
3619 */ 3663 */
3620 void API dw_window_pointer(HWND handle, int pointertype) 3664 void API dw_window_pointer(HWND handle, int pointertype)
3621 { 3665 {
3622 WinSetPointer(handle, 3666 dw_window_set_data(handle, "_dw_pointer",
3623 pointertype < 65535 ? 3667 pointertype < 65535 ?
3624 WinQuerySysPointer(HWND_DESKTOP, 3668 (void *)WinQuerySysPointer(HWND_DESKTOP,pointertype, FALSE)
3625 pointertype, 3669 : (void *)pointertype);
3626 FALSE) : (HPOINTER)pointertype);
3627 } 3670 }
3628 3671
3629 /* 3672 /*
3630 * Create a new Window Frame. 3673 * Create a new Window Frame.
3631 * Parameters: 3674 * Parameters: