+BEGIN_EVENT_TABLE(wxStaticBitmap, wxWindow)
+ EVT_PAINT(wxStaticBitmap::OnPaint)
+END_EVENT_TABLE()
+
+static wxGDIImage* ConvertImage(
+ const wxGDIImage& rBitmap
+)
+{
+ bool bIsIcon = rBitmap.IsKindOf( CLASSINFO(wxIcon) );
+
+ if(!bIsIcon )
+ {
+ wxASSERT_MSG( wxDynamicCast(&rBitmap, wxBitmap),
+ wxT("not an icon and not a bitmap?") );
+
+ const wxBitmap& rBmp = (const wxBitmap&)rBitmap;
+ wxMask* pMask = rBmp.GetMask();
+
+ if (pMask && pMask->GetMaskBitmap())
+ {
+ wxIcon* pIcon = new wxIcon;
+
+ pIcon->CopyFromBitmap(rBmp);
+ return pIcon;
+ }
+ return new wxBitmap(rBmp);
+ }
+
+ // copying a bitmap is a cheap operation
+ return new wxIcon( (const wxIcon&)rBitmap );
+} // end of ConvertImage