changeset 1256:51892bf7fe01

Attempt on Windows to use an icon handle for bitmap buttons before a bitmap... Since XP does not seem to support transparency on bitmaps.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 24 Oct 2011 07:56:20 +0000
parents 363d859e8372
children 35b177e8a0a2
files win/dw.c
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Mon Oct 24 06:29:05 2011 +0000
+++ b/win/dw.c	Mon Oct 24 07:56:20 2011 +0000
@@ -5462,17 +5462,22 @@
    HWND tmp;
    BubbleButton *bubble;
    HBITMAP hbitmap = 0;
-   HANDLE icon = 0;
+   HANDLE hicon = 0;
    int windowtype = 0, len;
 
    if (!(bubble = calloc(1, sizeof(BubbleButton))))
       return 0;
 
 #ifdef GDIPLUS
-   windowtype = BS_BITMAP;
-   hbitmap = _dw_load_bitmap(filename, NULL);
+   if((hicon = _dw_load_icon(filename)))
+      windowtype = BS_ICON;
+   else
+   {
+      hbitmap = _dw_load_bitmap(filename, NULL);
+      windowtype = BS_BITMAP;
+   }
 #else
-   windowtype = _dw_get_image_handle(filename, &icon, &hbitmap);
+   windowtype = _dw_get_image_handle(filename, &hicon, &hbitmap);
 #endif
 
    tmp = CreateWindow( BUTTONCLASSNAME,
@@ -5491,14 +5496,11 @@
 
    _create_tooltip(tmp, text);
 
-#ifndef GDIPLUS
-   if (icon)
-   {
-      SendMessage(tmp, BM_SETIMAGE,(WPARAM) IMAGE_ICON,(LPARAM) icon);
-   }
-   else 
-#endif
-   if (hbitmap)
+   if (hicon)
+   {
+      SendMessage(tmp, BM_SETIMAGE,(WPARAM) IMAGE_ICON,(LPARAM) hicon);
+   }
+   else if (hbitmap)
    {
       SendMessage(tmp, BM_SETIMAGE,(WPARAM) IMAGE_BITMAP, (LPARAM) hbitmap);
    }