Mercurial > dwindows
comparison win/dw.c @ 1660:28775ce2d26c
Okay second attempt at that Windows 7 icon/bitmap fix...
Last fix broke auto-sizing using HBITMAPS... this one seems
to work for both HBITMAP and HICON but need to test on XP.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 16 Apr 2012 17:16:19 +0000 |
parents | d06255e46ce2 |
children | 620df4222086 |
comparison
equal
deleted
inserted
replaced
1659:d06255e46ce2 | 1660:28775ce2d26c |
---|---|
4560 if(*buf) | 4560 if(*buf) |
4561 dw_font_text_extents_get(handle, NULL, buf, &thiswidth, &thisheight); | 4561 dw_font_text_extents_get(handle, NULL, buf, &thiswidth, &thisheight); |
4562 dw_free(buf); | 4562 dw_free(buf); |
4563 } | 4563 } |
4564 | 4564 |
4565 /* Attempt to get bitmap from classes that can have them */ | 4565 /* Attempt to get icon from classes that can have them */ |
4566 if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1) == 0) | 4566 if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1) == 0) |
4567 { | 4567 hic = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0); |
4568 if(!(hic = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0))) | 4568 else if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) |
4569 hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); | 4569 hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0); |
4570 } | |
4571 if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) | |
4572 { | |
4573 if(!(hic = (HICON)SendMessage(handle, BM_GETIMAGE, IMAGE_ICON, 0))) | |
4574 hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); | |
4575 } | |
4576 | 4570 |
4577 /* If we got an icon, pull out the internal bitmap */ | 4571 /* If we got an icon, pull out the internal bitmap */ |
4578 if(hic && !hbm) | 4572 if(hic) |
4579 { | 4573 { |
4580 ICONINFO ii; | 4574 ICONINFO ii; |
4581 | 4575 |
4582 if(GetIconInfo(hic, &ii)) | 4576 if(GetIconInfo(hic, &ii)) |
4583 hbm = ii.hbmMask ? ii.hbmMask : ii.hbmColor; | 4577 hbm = ii.hbmMask ? ii.hbmMask : ii.hbmColor; |
4578 } | |
4579 | |
4580 /* If we weren't able to get the bitmap from the icon... */ | |
4581 if(!hbm) | |
4582 { | |
4583 /* Attempt to get bitmap from classes that can have them */ | |
4584 if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1) == 0) | |
4585 hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); | |
4586 else if(_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) == 0) | |
4587 hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); | |
4584 } | 4588 } |
4585 | 4589 |
4586 /* If we got an image... set the sizes appropriately */ | 4590 /* If we got an image... set the sizes appropriately */ |
4587 if(hbm) | 4591 if(hbm) |
4588 { | 4592 { |