// Create from XPM data
bool wxBitmap::CreateFromXpm(const char **data)
{
-#if wxUSE_IMAGE && wxUSE_XPM
+#if wxUSE_IMAGE && wxUSE_XPM && wxUSE_WXDIB
Init();
wxCHECK_MSG( data != NULL, false, wxT("invalid bitmap data") )
return handler->LoadFile(this, filename, type, -1, -1);
}
-#if wxUSE_IMAGE
+#if wxUSE_IMAGE && wxUSE_WXDIB
else // no bitmap handler found
{
wxImage image;
{
return handler->SaveFile(this, filename, type, palette);
}
-#if wxUSE_IMAGE
+#if wxUSE_IMAGE && wxUSE_WXDIB
else // no bitmap handler found
{
// FIXME what about palette? shouldn't we use it?
return 0;
}
- wxMask* mask;
- wxBitmap newbmp;
if ( bmp.HasAlpha() )
{
- // Convert alpha to a mask. NOTE: It would be better to actually put
- // the alpha into the icon instead of making a mask, but I don't have
- // time to figure that out today.
- wxImage img = bmp.ConvertToImage();
- img.ConvertAlphaToMask();
- newbmp = wxBitmap(img);
- mask = newbmp.GetMask();
- }
- else
- {
- mask = bmp.GetMask();
+ // Create an empty mask bitmap.
+ // it doesn't seem to work if we mess with the mask at all.
+ HBITMAP hMonoBitmap = CreateBitmap(bmp.GetWidth(),bmp.GetHeight(),1,1,NULL);
+
+ ICONINFO iconInfo;
+ wxZeroMemory(iconInfo);
+ iconInfo.fIcon = iconWanted; // do we want an icon or a cursor?
+ if ( !iconWanted )
+ {
+ iconInfo.xHotspot = hotSpotX;
+ iconInfo.yHotspot = hotSpotY;
+ }
+
+ iconInfo.hbmMask = hMonoBitmap;
+ iconInfo.hbmColor = GetHbitmapOf(bmp);
+
+ HICON hicon = ::CreateIconIndirect(&iconInfo);
+
+ ::DeleteObject(hMonoBitmap);
+
+ return hicon;
}
+ wxMask* mask = bmp.GetMask();
+
if ( !mask )
{
// we must have a mask for an icon, so even if it's probably incorrect,