- m_refData = new wxBitmapRefData();
- M_BMPDATA->m_mask = NULL;
- M_BMPDATA->m_pixmap =
- gdk_pixmap_new( (GdkWindow*) &gdk_root_parent, width, height, depth );
- M_BMPDATA->m_width = width;
- M_BMPDATA->m_height = height;
- M_BMPDATA->m_bpp = depth;
-
- if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
-};
+ wxCHECK_RET( (width > 0) && (height > 0), "invalid bitmap size" )
+ wxCHECK_RET( (depth > 0) || (depth == -1), "invalid bitmap depth" )
+
+ m_refData = new wxBitmapRefData();
+
+ GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
+
+ M_BMPDATA->m_mask = (wxMask *) NULL;
+ M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
+ M_BMPDATA->m_width = width;
+ M_BMPDATA->m_height = height;
+ M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
+
+ if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
+}
+
+wxBitmap::wxBitmap( const char **bits )
+{
+ wxCHECK_RET( bits != NULL, "invalid bitmap data" )
+
+ m_refData = new wxBitmapRefData();
+
+ GdkBitmap *mask = (GdkBitmap*) NULL;
+ GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
+
+ M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
+
+ if (mask)
+ {
+ M_BMPDATA->m_mask = new wxMask();
+ M_BMPDATA->m_mask->m_bitmap = mask;
+ }
+
+ gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
+
+ M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
+ if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
+}