changeset 155:840c54766306

Another sync of sources, enhancements to dw_window_set_color() ... works completely on Windows now and added DW_CLR_DEFAULT. Also color pairs don't need to be of the same type anymore.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 07 Nov 2002 22:31:02 +0000
parents 7f8fcce45bdd
children 63258b34e70d
files dw.h gtk/dw.c os2/dw.c win/dw.c
diffstat 4 files changed, 245 insertions(+), 143 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Thu Nov 07 06:21:29 2002 +0000
+++ b/dw.h	Thu Nov 07 22:31:02 2002 +0000
@@ -54,6 +54,7 @@
 
 #define DW_CLR_WHITE             16
 #define DW_CLR_BLACK             17
+#define DW_CLR_DEFAULT           18
 #define DW_CLR_BLUE              CLR_BLUE
 #define DW_CLR_RED               CLR_RED
 #define DW_CLR_PINK              CLR_PINK
@@ -203,6 +204,7 @@
 #define DW_CLR_PINK              13
 #define DW_CLR_CYAN              14
 #define DW_CLR_WHITE             15
+#define DW_CLR_DEFAULT           16
 
 #define DW_FCF_TITLEBAR          WS_CAPTION
 #define DW_FCF_SYSMENU           WS_SYSMENU
@@ -414,6 +416,7 @@
 #define DW_CLR_PINK              13
 #define DW_CLR_CYAN              14
 #define DW_CLR_WHITE             15
+#define DW_CLR_DEFAULT           16
 
 #define DW_FCF_TITLEBAR          1
 #define DW_FCF_SYSMENU           (1 << 1)
--- a/gtk/dw.c	Thu Nov 07 06:21:29 2002 +0000
+++ b/gtk/dw.c	Thu Nov 07 22:31:02 2002 +0000
@@ -1324,89 +1324,101 @@
 
 int _set_color(HWND handle, unsigned long fore, unsigned long back)
 {
+	/* Remember that each color component in X11 use 16 bit no matter
+	 * what the destination display supports. (and thus GDK)
+	 */
+	GdkColor forecolor, backcolor;
 #if GTK_MAJOR_VERSION < 2
-	GtkStyle *style;
+	GtkStyle *style = gtk_style_copy(gtk_widget_get_style(handle));
 #endif
 
-	if(fore & DW_RGB_COLOR || back & DW_RGB_COLOR)
-	{
-		/* Remember that each color component in X11 use 16 bit no matter
-		 * what the destination display supports. (and thus GDK)
-		 */
-		GdkColor forecolor = { 0, DW_RED_VALUE(fore) << 8, DW_GREEN_VALUE(fore) << 8, DW_BLUE_VALUE(fore) << 8 };
-		GdkColor backcolor = { 0, DW_RED_VALUE(back) << 8, DW_GREEN_VALUE(back) << 8, DW_BLUE_VALUE(back) << 8 };
+	if(fore & DW_RGB_COLOR)
+	{
+		forecolor.pixel = 0;
+		forecolor.red = DW_RED_VALUE(fore) << 8;
+		forecolor.green = DW_GREEN_VALUE(fore) << 8;
+		forecolor.blue = DW_BLUE_VALUE(fore) << 8;
 
 		gdk_color_alloc(_dw_cmap, &forecolor);
-		gdk_color_alloc(_dw_cmap, &backcolor);
 
 #if GTK_MAJOR_VERSION > 1
 		gtk_widget_modify_text(handle, 0, &forecolor);
 		gtk_widget_modify_text(handle, 1, &forecolor);
 		gtk_widget_modify_fg(handle, 0, &forecolor);
 		gtk_widget_modify_fg(handle, 1, &forecolor);
+#else
+		if(style)
+			style->text[0] = style->text[1] = style->fg[0] = style->fg[1] = forecolor;
+#endif
+	}
+	else if(fore != DW_CLR_DEFAULT)
+	{
+		forecolor = _colors[fore];
+
+#if GTK_MAJOR_VERSION > 1
+		gtk_widget_modify_text(handle, 0, &_colors[fore]);
+		gtk_widget_modify_text(handle, 1, &_colors[fore]);
+		gtk_widget_modify_fg(handle, 0, &_colors[fore]);
+		gtk_widget_modify_fg(handle, 1, &_colors[fore]);
+#else
+		if(style)
+			style->text[0] = style->text[1] = style->fg[0] = style->fg[1] = _colors[fore];
+#endif
+	}
+	if(back & DW_RGB_COLOR)
+	{
+		backcolor.pixel = 0;
+		backcolor.red = DW_RED_VALUE(back) << 8;
+		backcolor.green = DW_GREEN_VALUE(back) << 8;
+		backcolor.blue = DW_BLUE_VALUE(back) << 8;
+
+		gdk_color_alloc(_dw_cmap, &backcolor);
+
+#if GTK_MAJOR_VERSION > 1
 		gtk_widget_modify_base(handle, 0, &backcolor);
 		gtk_widget_modify_base(handle, 1, &backcolor);
 		gtk_widget_modify_bg(handle, 0, &backcolor);
 		gtk_widget_modify_bg(handle, 1, &backcolor);
 #else
-		style = gtk_style_copy(gtk_widget_get_style(handle));
 		if(style)
-		{
-			style->text[0] = style->text[1] = style->fg[0] = style->fg[1] = forecolor;
 			style->base[0] = style->base[1] = style->bg[0] = style->bg[1] = backcolor;
-			gtk_widget_set_style(handle, style);
-			gtk_style_unref(style);
-		}
 #endif
-
-		_save_gdk_colors(handle, forecolor, backcolor);
-
-		if(GTK_IS_CLIST(handle))
-		{
-			int z, rowcount = (int)gtk_object_get_data(GTK_OBJECT(handle), "rowcount");
-
-			for(z=0;z<rowcount;z++)
-			{
-				gtk_clist_set_foreground(GTK_CLIST(handle), z, &forecolor);
-				gtk_clist_set_background(GTK_CLIST(handle), z, &backcolor);
-			}
-		}
-	}
-	else
-	{
+	}
+	else if(back != DW_CLR_DEFAULT)
+	{
+		backcolor = _colors[back];
+
 #if GTK_MAJOR_VERSION > 1
-		gtk_widget_modify_text(handle, 0, &_colors[fore]);
-		gtk_widget_modify_text(handle, 1, &_colors[fore]);
-		gtk_widget_modify_fg(handle, 0, &_colors[fore]);
-		gtk_widget_modify_fg(handle, 1, &_colors[fore]);
 		gtk_widget_modify_base(handle, 0, &_colors[back]);
 		gtk_widget_modify_base(handle, 1, &_colors[back]);
 		gtk_widget_modify_bg(handle, 0, &_colors[back]);
 		gtk_widget_modify_bg(handle, 1, &_colors[back]);
 #else
-		style = gtk_style_copy(gtk_widget_get_style(handle));
 		if(style)
-		{
-			style->text[0] = style->text[1] = style->fg[0] = style->fg[1] = _colors[fore];
 			style->base[0] = style->base[1] = style->bg[0] = style->bg[1] = _colors[back];
-			gtk_widget_set_style(handle, style);
-		}
 #endif
-
-		_save_gdk_colors(handle, _colors[fore], _colors[back]);
-
-		if(GTK_IS_CLIST(handle))
+	}
+
+	_save_gdk_colors(handle, forecolor, backcolor);
+
+	if(GTK_IS_CLIST(handle))
+	{
+		int z, rowcount = (int)gtk_object_get_data(GTK_OBJECT(handle), "rowcount");
+
+		for(z=0;z<rowcount;z++)
 		{
-			int z, rowcount = (int)gtk_object_get_data(GTK_OBJECT(handle), "rowcount");
-
-			for(z=0;z<rowcount;z++)
-			{
-				gtk_clist_set_foreground(GTK_CLIST(handle), z, &_colors[fore]);
-				gtk_clist_set_background(GTK_CLIST(handle), z, &_colors[back]);
-			}
+			gtk_clist_set_foreground(GTK_CLIST(handle), z, &forecolor);
+			gtk_clist_set_background(GTK_CLIST(handle), z, &backcolor);
 		}
 	}
 
+#if GTK_MAJOR_VERSION < 2
+	if(style)
+	{
+		gtk_widget_set_style(handle, style);
+		gtk_style_unref(style);
+	}
+#endif
 	return TRUE;
 }
 /*
--- a/os2/dw.c	Thu Nov 07 06:21:29 2002 +0000
+++ b/os2/dw.c	Thu Nov 07 22:31:02 2002 +0000
@@ -1384,6 +1384,8 @@
 #define ENTRY_CUT   1001
 #define ENTRY_COPY  1002
 #define ENTRY_PASTE 1003
+#define ENTRY_UNDO  1004
+#define ENTRY_SALL  1005
 
 /* Originally just intended for entryfields, it now serves as a generic
  * procedure for handling TAB presses to change input focus on controls.
@@ -1413,13 +1415,21 @@
 				HMENUI hwndMenu = dw_menu_new(0L);
 				long x, y;
 
+				if(strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0))
+				{
+					menuitem = dw_menu_append_item(hwndMenu, "Undo", ENTRY_UNDO, 0L, TRUE, FALSE, 0L);
+					dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L);
+				}
 				menuitem = dw_menu_append_item(hwndMenu, "Copy", ENTRY_COPY, 0L, TRUE, FALSE, 0L);
 				if(strncmp(tmpbuf, "#10", 4)!=0 || (strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0)))
 				{
 					menuitem = dw_menu_append_item(hwndMenu, "Cut", ENTRY_CUT, 0L, TRUE, FALSE, 0L);
 					menuitem = dw_menu_append_item(hwndMenu, "Paste", ENTRY_PASTE, 0L, TRUE, FALSE, 0L);
 				}
-
+				dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L);
+				menuitem = dw_menu_append_item(hwndMenu, "Select All", ENTRY_SALL, 0L, TRUE, FALSE, 0L);
+
+				WinSetFocus(HWND_DESKTOP, hWnd);
 				dw_pointer_query_pos(&x, &y);
 				dw_menu_popup(&hwndMenu, hWnd, x, y);
 			}
@@ -1439,6 +1449,13 @@
 						return WinSendMsg(hWnd, MLM_COPY, 0, 0);
 					case ENTRY_PASTE:
 						return WinSendMsg(hWnd, MLM_PASTE, 0, 0);
+					case ENTRY_UNDO:
+						return WinSendMsg(hWnd, MLM_UNDO, 0, 0);
+					case ENTRY_SALL:
+						{
+							ULONG len = (ULONG)WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0);
+							return WinSendMsg(hWnd, MLM_SETSEL, 0, (MPARAM)len);
+						}
 					}
 				}
 				else /* Other */
@@ -1461,6 +1478,11 @@
 							return WinSendMsg(handle, EM_COPY, 0, 0);
 						case ENTRY_PASTE:
 							return WinSendMsg(handle, EM_PASTE, 0, 0);
+						case ENTRY_SALL:
+							{
+								LONG len = WinQueryWindowTextLength(hWnd);
+								return WinSendMsg(hWnd, EM_SETSEL, MPFROM2SHORT(0, (SHORT)len), 0);
+							}
 						}
 					}
 				}
@@ -1563,7 +1585,7 @@
 		{
 			USHORT pos = SHORT1FROMMP(mp2);
 
-			return WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION));
+			WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION));
 		}
 		break;
 	}
@@ -3204,6 +3226,15 @@
 		WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
 
 	}
+	else if(fore != DW_CLR_DEFAULT)
+	{
+		if(fore == DW_CLR_BLACK)
+			fore = CLR_BLACK;
+		if(fore == DW_CLR_WHITE)
+			fore = CLR_WHITE;
+
+		WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore);
+	}
 	if((back & DW_RGB_COLOR) == DW_RGB_COLOR)
 	{
 		RGB2 rgb2;
@@ -3216,22 +3247,16 @@
 		WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
 		return 0;
 	}
-	if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
-		return 0;
-
-	/* Slight conversion */
-	if(fore == DW_CLR_BLACK)
-		fore = CLR_BLACK;
-	if(fore == DW_CLR_WHITE)
-		fore = CLR_WHITE;
-
-	if(back == DW_CLR_BLACK)
-		back = CLR_BLACK;
-	if(back == DW_CLR_WHITE)
-		back = CLR_WHITE;
-
-	return (WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore) |
-			WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back));
+	else if(back != DW_CLR_DEFAULT)
+	{
+		if(back == DW_CLR_BLACK)
+			back = CLR_BLACK;
+		if(back == DW_CLR_WHITE)
+			back = CLR_WHITE;
+
+		WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
+	}
+	return 0;
 }
 
 /*
--- a/win/dw.c	Thu Nov 07 06:21:29 2002 +0000
+++ b/win/dw.c	Thu Nov 07 22:31:02 2002 +0000
@@ -1510,28 +1510,48 @@
 			ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong((HWND)mp2, GWL_USERDATA);
 			if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1)
 			{
-				if(thiscinfo->fore > -1 && thiscinfo->back > -1 &&
-				   thiscinfo->fore < 18 && thiscinfo->back < 18)
+				/* Handle foreground */
+				if(thiscinfo->fore > -1 && thiscinfo->fore < 18)
 				{
-					SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore],
-											   _green[thiscinfo->fore],
-											   _blue[thiscinfo->fore]));
-					SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back],
-											 _green[thiscinfo->back],
-											 _blue[thiscinfo->back]));
-					if(thiscinfo->hbrush)
-						DeleteObject(thiscinfo->hbrush);
-					thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back],
-															 _green[thiscinfo->back],
-															 _blue[thiscinfo->back]));
-					SelectObject((HDC)mp1, thiscinfo->hbrush);
-					return (LONG)thiscinfo->hbrush;
+					if(thiscinfo->fore != DW_CLR_DEFAULT)
+					{
+						SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore],
+												   _green[thiscinfo->fore],
+												   _blue[thiscinfo->fore]));
+					}
 				}
-				if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR && (thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR)
+				else if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR)
 				{
 					SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->fore),
 											   DW_GREEN_VALUE(thiscinfo->fore),
 											   DW_BLUE_VALUE(thiscinfo->fore)));
+				}
+				/* Handle background */
+				if(thiscinfo->back > -1 && thiscinfo->back < 18)
+				{
+					if(thiscinfo->back == DW_CLR_DEFAULT)
+					{
+						HBRUSH hbr = GetSysColorBrush(COLOR_3DFACE);
+
+						SelectObject((HDC)mp1, hbr);
+						return (LONG)hbr;
+					}
+					else
+					{
+						SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back],
+												 _green[thiscinfo->back],
+												 _blue[thiscinfo->back]));
+						if(thiscinfo->hbrush)
+							DeleteObject(thiscinfo->hbrush);
+						thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back],
+																 _green[thiscinfo->back],
+																 _blue[thiscinfo->back]));
+						SelectObject((HDC)mp1, thiscinfo->hbrush);
+					}
+					return (LONG)thiscinfo->hbrush;
+				}
+				else if((thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR)
+				{
 					SetBkColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->back),
 												 DW_GREEN_VALUE(thiscinfo->back),
 												 DW_BLUE_VALUE(thiscinfo->back)));
@@ -1588,38 +1608,56 @@
 				HDC hdcPaint = BeginPaint(hWnd, &ps);
 				int success = FALSE;
 
-				if(thiscinfo->fore > -1 && thiscinfo->back > -1 &&
-				   thiscinfo->fore < 18 && thiscinfo->back < 18)
+				if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1)
 				{
-					SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore],
-											   _green[thiscinfo->fore],
-											   _blue[thiscinfo->fore]));
-					SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back],
-											 _green[thiscinfo->back],
-											 _blue[thiscinfo->back]));
-					DeleteObject(thiscinfo->hbrush);
-					thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back],
-															 _green[thiscinfo->back],
-															 _blue[thiscinfo->back]));
-					SelectObject(hdcPaint, thiscinfo->hbrush);
-					Rectangle(hdcPaint, ps.rcPaint.left - 1, ps.rcPaint.top - 1, ps.rcPaint.right + 1, ps.rcPaint.bottom + 1);
-					success = TRUE;
-				}
-				if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR && (thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR)
-				{
-					SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->fore),
-											   DW_GREEN_VALUE(thiscinfo->fore),
-											   DW_BLUE_VALUE(thiscinfo->fore)));
-					SetBkColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->back),
-											 DW_GREEN_VALUE(thiscinfo->back),
-											 DW_BLUE_VALUE(thiscinfo->back)));
-					DeleteObject(thiscinfo->hbrush);
-					thiscinfo->hbrush = CreateSolidBrush(RGB(DW_RED_VALUE(thiscinfo->back),
-															 DW_GREEN_VALUE(thiscinfo->back),
-															 DW_BLUE_VALUE(thiscinfo->back)));
-					SelectObject(hdcPaint, thiscinfo->hbrush);
-					Rectangle(hdcPaint, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
-					success = TRUE;
+					/* Handle foreground */
+					if(thiscinfo->fore > -1 && thiscinfo->fore < 18)
+					{
+						if(thiscinfo->fore != DW_CLR_DEFAULT)
+						{
+							SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore],
+													   _green[thiscinfo->fore],
+													   _blue[thiscinfo->fore]));
+						}
+					}
+					else if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR)
+					{
+						SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->fore),
+												   DW_GREEN_VALUE(thiscinfo->fore),
+												   DW_BLUE_VALUE(thiscinfo->fore)));
+					}
+					/* Handle background */
+					if(thiscinfo->back > -1 && thiscinfo->back < 18)
+					{
+						if(thiscinfo->back != DW_CLR_DEFAULT)
+						{
+							SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back],
+													 _green[thiscinfo->back],
+													 _blue[thiscinfo->back]));
+							if(thiscinfo->hbrush)
+								DeleteObject(thiscinfo->hbrush);
+							thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back],
+																	 _green[thiscinfo->back],
+																	 _blue[thiscinfo->back]));
+							SelectObject(hdcPaint, thiscinfo->hbrush);
+							Rectangle(hdcPaint, ps.rcPaint.left - 1, ps.rcPaint.top - 1, ps.rcPaint.right + 1, ps.rcPaint.bottom + 1);
+							success = TRUE;
+						}
+					}
+					else if((thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR)
+					{
+						SetBkColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->back),
+												 DW_GREEN_VALUE(thiscinfo->back),
+												 DW_BLUE_VALUE(thiscinfo->back)));
+						if(thiscinfo->hbrush)
+							DeleteObject(thiscinfo->hbrush);
+						thiscinfo->hbrush = CreateSolidBrush(RGB(DW_RED_VALUE(thiscinfo->back),
+																 DW_GREEN_VALUE(thiscinfo->back),
+																 DW_BLUE_VALUE(thiscinfo->back)));
+						SelectObject(hdcPaint, thiscinfo->hbrush);
+						Rectangle(hdcPaint, ps.rcPaint.left - 1, ps.rcPaint.top - 1, ps.rcPaint.right + 1, ps.rcPaint.bottom + 1);
+						success = TRUE;
+					}
 				}
 
 				EndPaint(hWnd, &ps);
@@ -1937,28 +1975,51 @@
 				ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong((HWND)mp2, GWL_USERDATA);
 				if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1)
 				{
-					if(thiscinfo->fore > -1 && thiscinfo->back > -1 &&
-					   thiscinfo->fore < 18 && thiscinfo->back < 18)
+					/* Handle foreground */
+					if(thiscinfo->fore > -1 && thiscinfo->fore < 18)
 					{
-						SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore],
-												   _green[thiscinfo->fore],
-											   _blue[thiscinfo->fore]));
-						SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back],
-												 _green[thiscinfo->back],
-												 _blue[thiscinfo->back]));
-						if(thiscinfo->hbrush)
-							DeleteObject(thiscinfo->hbrush);
-						thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back],
-																 _green[thiscinfo->back],
-																 _blue[thiscinfo->back]));
-						SelectObject((HDC)mp1, thiscinfo->hbrush);
-						return (LONG)thiscinfo->hbrush;
+						if(thiscinfo->fore != DW_CLR_DEFAULT)
+						{
+							SetTextColor((HDC)mp1, RGB(_red[thiscinfo->fore],
+													   _green[thiscinfo->fore],
+													   _blue[thiscinfo->fore]));
+						}
 					}
-					if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR && (thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR)
+					else if((thiscinfo->fore & DW_RGB_COLOR) == DW_RGB_COLOR)
 					{
 						SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->fore),
 												   DW_GREEN_VALUE(thiscinfo->fore),
 												   DW_BLUE_VALUE(thiscinfo->fore)));
+					}
+					/* Handle background */
+					if(thiscinfo->back > -1 && thiscinfo->back < 18)
+					{
+						if(thiscinfo->back == DW_CLR_DEFAULT)
+						{
+							HBRUSH hbr = GetSysColorBrush(COLOR_3DFACE);
+
+							SetBkColor((HDC)mp1, GetSysColor(COLOR_3DFACE));
+
+
+							SelectObject((HDC)mp1, hbr);
+							return (LONG)hbr;
+						}
+						else
+						{
+							SetBkColor((HDC)mp1, RGB(_red[thiscinfo->back],
+													 _green[thiscinfo->back],
+													 _blue[thiscinfo->back]));
+							if(thiscinfo->hbrush)
+								DeleteObject(thiscinfo->hbrush);
+							thiscinfo->hbrush = CreateSolidBrush(RGB(_red[thiscinfo->back],
+																	 _green[thiscinfo->back],
+																	 _blue[thiscinfo->back]));
+							SelectObject((HDC)mp1, thiscinfo->hbrush);
+						}
+						return (LONG)thiscinfo->hbrush;
+					}
+					else if((thiscinfo->back & DW_RGB_COLOR) == DW_RGB_COLOR)
+					{
 						SetBkColor((HDC)mp1, RGB(DW_RED_VALUE(thiscinfo->back),
 												 DW_GREEN_VALUE(thiscinfo->back),
 												 DW_BLUE_VALUE(thiscinfo->back)));
@@ -4023,17 +4084,18 @@
  */
 HWND dw_listbox_new(ULONG id, int multi)
 {
-	HWND tmp = CreateWindow(LISTBOXCLASSNAME,
-							"",
-							WS_VISIBLE | LBS_NOINTEGRALHEIGHT |
-							WS_CHILD | LBS_HASSTRINGS |
-							LBS_NOTIFY | WS_BORDER  | WS_CLIPCHILDREN |
-							WS_VSCROLL | (multi ? LBS_MULTIPLESEL : 0) ,
-							0,0,2000,1000,
-							DW_HWND_OBJECT,
-							(HMENU)id,
-							DWInstance,
-							NULL);
+	HWND tmp = CreateWindowEx(WS_EX_CLIENTEDGE,
+							  LISTBOXCLASSNAME,
+							  "",
+							  WS_VISIBLE | LBS_NOINTEGRALHEIGHT |
+							  WS_CHILD | LBS_HASSTRINGS |
+							  LBS_NOTIFY | WS_BORDER  | WS_CLIPCHILDREN |
+							  WS_VSCROLL | (multi ? LBS_MULTIPLESEL : 0) ,
+							  0,0,2000,1000,
+							  DW_HWND_OBJECT,
+							  (HMENU)id,
+							  DWInstance,
+							  NULL);
 	ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo));
 
 	if(!cinfo)