changeset 552:d940dc1ff462

Initial code to support icons in dw_bitmapbutton_new() but it doesn't seem to like my 20x20 icons. :(
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 11 Apr 2004 05:58:43 +0000
parents 756477206006
children 788299414ae0
files win/dw.c
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Sun Apr 11 04:39:04 2004 +0000
+++ b/win/dw.c	Sun Apr 11 05:58:43 2004 +0000
@@ -4501,6 +4501,7 @@
 	HWND tmp;
 	BubbleButton *bubble = calloc(1, sizeof(BubbleButton));
 	HBITMAP hbitmap = LoadBitmap(DWInstance, MAKEINTRESOURCE(id));
+	HICON icon = LoadIcon(DWInstance, MAKEINTRESOURCE(id));
 
 	tmp = CreateWindow(BUTTONCLASSNAME,
 					   "",
@@ -4520,9 +4521,18 @@
 
 	SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)bubble);
 
-	SendMessage(tmp, BM_SETIMAGE,
-				(WPARAM) IMAGE_BITMAP,
-				(LPARAM) hbitmap);
+	if(icon)
+	{
+		SendMessage(tmp, BM_SETIMAGE,
+					(WPARAM) IMAGE_ICON,
+					(LPARAM) icon);
+	}
+	else if(hbitmap)
+	{
+		SendMessage(tmp, BM_SETIMAGE,
+					(WPARAM) IMAGE_BITMAP,
+					(LPARAM) hbitmap);
+	}
 	return tmp;
 }