- m_needParent = TRUE;
-
- wxSize newSize = size;
-
- PreCreation( parent, id, pos, size, style, name );
-
- m_bitmap = bitmap;
-
- if (m_bitmap.Ok())
- {
- GdkBitmap *mask = (GdkBitmap *) NULL;
- if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
- m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
-
- if (newSize.x == -1) newSize.x = m_bitmap.GetWidth();
- if (newSize.y == -1) newSize.y = m_bitmap.GetHeight();
- SetSize( newSize.x, newSize.y );
- }
- else
- {
- m_widget = gtk_label_new( "Bitmap" );
- }
-
- m_parent->AddChild( this );
-
- (m_parent->m_insertCallback)( m_parent, this );
-
- PostCreation();
-
- Show( TRUE );
-
- return TRUE;
+ m_needParent = TRUE;
+
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+ {
+ wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
+ return false;
+ }
+
+ m_bitmap = bitmap;
+
+ wxBitmap bmp(bitmap.IsOk() ? bitmap : wxBitmap(bogus_xpm));
+ m_widget = gtk_pixmap_new(bmp.GetPixmap(), NULL);
+
+ if (bitmap.IsOk())
+ SetBitmap(bitmap);
+
+ PostCreation(size);
+ m_parent->DoAddChild( this );
+
+ return true;