+ 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);