+#if wxUSE_XPM_IN_MSW
+
+static void XpmToBitmap(wxBitmap *bitmap,
+ const XImage *ximage,
+ const XImage *xmask,
+ const XpmAttributes& xpmAttr)
+{
+ wxBitmapRefData *refData = bitmap->GetBitmapData();
+ refData->m_hBitmap = (WXHBITMAP)ximage->bitmap;
+
+ // first set the bitmap width, height, depth...
+ BITMAP bm;
+ if ( !::GetObject(GetHbitmapOf(*bitmap), sizeof(bm), (LPSTR) & bm) )
+ {
+ wxLogLastError(wxT("GetObject(bitmap)"));
+ }
+
+ refData->m_width = bm.bmWidth;
+ refData->m_height = bm.bmHeight;
+ refData->m_depth = bm.bmPlanes * bm.bmBitsPixel;
+ refData->m_numColors = xpmAttr.npixels;
+
+ // GRG Jan/2000, mask support
+ if (xmask)
+ {
+ wxMask *mask = new wxMask();
+ mask->SetMaskBitmap((WXHBITMAP) wxInvertMask(xmask->bitmap,
+ bm.bmWidth, bm.bmHeight));
+ bitmap->SetMask(mask);
+ }
+}
+
+#endif // wxUSE_XPM_IN_MSW
+