+// we may have either bitmap or icon: if a bitmap with mask is passed, we
+// will transform it to an icon ourselves because otherwise the mask will
+// be ignored by Windows
+// note that this function will create a new object every time
+// it is called even if the image needs no conversion
+
+#ifndef __WIN16__
+
+static wxGDIImage* ConvertImage( const wxGDIImage& bitmap )
+{
+ bool isIcon = bitmap.IsKindOf( CLASSINFO(wxIcon) );
+
+ if( !isIcon )
+ {
+ wxASSERT_MSG( wxDynamicCast(&bitmap, wxBitmap),
+ _T("not an icon and not a bitmap?") );
+
+ const wxBitmap& bmp = (const wxBitmap&)bitmap;
+ wxMask *mask = bmp.GetMask();
+ if ( mask && mask->GetMaskBitmap() )
+ {
+ wxIcon* icon = new wxIcon;
+ icon->CopyFromBitmap(bmp);
+
+ return icon;
+ }
+
+ return new wxBitmap( bmp );
+ }
+
+ // copying a bitmap is a cheap operation
+ return new wxIcon( (const wxIcon&)bitmap );
+}
+
+#endif
+