Mercurial > dwindows
comparison os2/dw.c @ 377:d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
size when calculating the area to fill. Also, it checks the color set
by the user on the parent box to use the correct fill color.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 27 Apr 2003 23:00:35 +0000 |
parents | b812cf360e49 |
children | a7a561103eac |
comparison
equal
deleted
inserted
replaced
376:b812cf360e49 | 377:d8176c73a081 |
---|---|
1736 case WM_SETFOCUS: | 1736 case WM_SETFOCUS: |
1737 _run_event(hWnd, msg, mp1, mp2); | 1737 _run_event(hWnd, msg, mp1, mp2); |
1738 break; | 1738 break; |
1739 case WM_PAINT: | 1739 case WM_PAINT: |
1740 { | 1740 { |
1741 HWND parent = WinQueryWindow(hWnd, QW_PARENT); | 1741 HWND entry, parent = WinQueryWindow(hWnd, QW_PARENT); |
1742 ULONG bcol, av[32]; | |
1743 HPS hpsPaint; | 1742 HPS hpsPaint; |
1744 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */ | 1743 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */ |
1745 unsigned long width, height, thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW) + 6; | 1744 unsigned long width, height, thumbheight = 0; |
1746 | 1745 ULONG color; |
1747 WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, &bcol, sizeof(ULONG), &av, QPF_ID1COLORINDEX | QPF_NOINHERIT); | 1746 |
1748 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); | 1747 if((entry = (HWND)dw_window_get_data(hWnd, "_dw_comboentry")) != NULLHANDLE) |
1748 dw_window_get_pos_size(entry, 0, 0, 0, &thumbheight); | |
1749 | |
1750 if(!thumbheight) | |
1751 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW); | |
1752 | |
1753 thumbheight += 6; | |
1754 | |
1755 color = (ULONG)dw_window_get_data(parent, "_dw_fore"); | |
1756 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); | |
1749 | 1757 |
1750 hpsPaint = WinGetPS(hWnd); | 1758 hpsPaint = WinGetPS(hWnd); |
1751 GpiSetColor(hpsPaint, CLR_PALEGRAY); | 1759 if(color) |
1760 GpiSetColor(hpsPaint, _internal_color(color-1)); | |
1761 else | |
1762 GpiSetColor(hpsPaint, CLR_PALEGRAY); | |
1752 | 1763 |
1753 ptl.x = 0; | 1764 ptl.x = 0; |
1754 ptl.y = 0; | 1765 ptl.y = 96; |
1755 GpiMove(hpsPaint, &ptl); | 1766 GpiMove(hpsPaint, &ptl); |
1756 | 1767 |
1757 ptl.x = width; | 1768 ptl.x = width; |
1758 ptl.y = height - thumbheight; | 1769 ptl.y = height - thumbheight; |
1759 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0); | 1770 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0); |
4195 HWND_TOP, | 4206 HWND_TOP, |
4196 id, | 4207 id, |
4197 NULL, | 4208 NULL, |
4198 NULL); | 4209 NULL); |
4199 HENUM henum = WinBeginEnumWindows(tmp); | 4210 HENUM henum = WinBeginEnumWindows(tmp); |
4200 HWND child; | 4211 HWND child, last = NULLHANDLE; |
4201 | 4212 |
4202 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | 4213 while((child = WinGetNextWindow(henum)) != NULLHANDLE) |
4203 { | 4214 { |
4204 WindowData *moreblah = calloc(1, sizeof(WindowData)); | 4215 WindowData *moreblah = calloc(1, sizeof(WindowData)); |
4205 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc); | 4216 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc); |
4206 WinSetWindowPtr(child, QWP_USER, moreblah); | 4217 WinSetWindowPtr(child, QWP_USER, moreblah); |
4207 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE); | 4218 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE); |
4219 last = child; | |
4208 } | 4220 } |
4209 WinEndEnumWindows(henum); | 4221 WinEndEnumWindows(henum); |
4210 blah->oldproc = WinSubclassWindow(tmp, _comboproc); | 4222 blah->oldproc = WinSubclassWindow(tmp, _comboproc); |
4211 WinSetWindowPtr(tmp, QWP_USER, blah); | 4223 WinSetWindowPtr(tmp, QWP_USER, blah); |
4212 dw_window_set_font(tmp, DefaultFont); | 4224 dw_window_set_font(tmp, DefaultFont); |
4213 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); | 4225 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
4226 dw_window_set_data(tmp, "_dw_comboentry", (void *)last); | |
4214 return tmp; | 4227 return tmp; |
4215 } | 4228 } |
4216 | 4229 |
4217 /* | 4230 /* |
4218 * Create a new button window (widget) to be packed. | 4231 * Create a new button window (widget) to be packed. |