diff 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
line wrap: on
line diff
--- a/os2/dw.c	Sun Apr 27 20:27:59 2003 +0000
+++ b/os2/dw.c	Sun Apr 27 23:00:35 2003 +0000
@@ -1738,20 +1738,31 @@
 		break;
 	case WM_PAINT:
 		{
-			HWND parent = WinQueryWindow(hWnd, QW_PARENT);
-			ULONG bcol, av[32];
+			HWND entry, parent = WinQueryWindow(hWnd, QW_PARENT);
 			HPS hpsPaint;
 			POINTL ptl;                  /* Add 6 because it has a thick border like the entryfield */
-			unsigned long width, height, thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW) + 6;
-
-			WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, &bcol, sizeof(ULONG), &av, QPF_ID1COLORINDEX | QPF_NOINHERIT);
-            dw_window_get_pos_size(hWnd, 0, 0, &width, &height);
+			unsigned long width, height, thumbheight = 0;
+			ULONG color;
+
+			if((entry = (HWND)dw_window_get_data(hWnd, "_dw_comboentry")) != NULLHANDLE)
+				dw_window_get_pos_size(entry, 0, 0, 0, &thumbheight);
+
+			if(!thumbheight)
+				thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW);
+
+			thumbheight += 6;
+
+			color = (ULONG)dw_window_get_data(parent, "_dw_fore");
+			dw_window_get_pos_size(hWnd, 0, 0, &width, &height);
 
 			hpsPaint = WinGetPS(hWnd);
-			GpiSetColor(hpsPaint, CLR_PALEGRAY);
+			if(color)
+				GpiSetColor(hpsPaint, _internal_color(color-1));
+			else
+				GpiSetColor(hpsPaint, CLR_PALEGRAY);
 
 			ptl.x = 0;
-			ptl.y = 0;
+			ptl.y = 96;
 			GpiMove(hpsPaint, &ptl);
 
 			ptl.x = width;
@@ -4197,7 +4208,7 @@
 							   NULL,
 							   NULL);
 	HENUM henum = WinBeginEnumWindows(tmp);
-	HWND child;
+	HWND child, last = NULLHANDLE;
 	
 	while((child = WinGetNextWindow(henum)) != NULLHANDLE)
 	{
@@ -4205,12 +4216,14 @@
 		moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
 		WinSetWindowPtr(child, QWP_USER, moreblah);
 		dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE);
+		last = child;
 	}
 	WinEndEnumWindows(henum);
 	blah->oldproc = WinSubclassWindow(tmp, _comboproc);
 	WinSetWindowPtr(tmp, QWP_USER, blah);
 	dw_window_set_font(tmp, DefaultFont);
 	dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
+	dw_window_set_data(tmp, "_dw_comboentry", (void *)last);
 	return tmp;
 }