// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
-// Id:
+// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "gdk/gdkprivate.h"
#ifdef USE_GDK_IMLIB
-#include "gdk_imlib.h"
+#include "../gdk_imlib/gdk_imlib.h"
#endif
//-----------------------------------------------------------------------------
{
};
-wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), const int WXUNUSED(paletteIndex) )
+wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), int WXUNUSED(paletteIndex) )
{
};
// wxBitmap
//-----------------------------------------------------------------------------
+// CMB 20/5/98: added m_bitmap for GdkBitmaps
class wxBitmapRefData: public wxObjectRefData
{
public:
~wxBitmapRefData(void);
GdkPixmap *m_pixmap;
+ GdkBitmap *m_bitmap;
wxMask *m_mask;
int m_width;
int m_height;
wxBitmapRefData::wxBitmapRefData(void)
{
m_pixmap = NULL;
+ m_bitmap = NULL;
m_mask = NULL;
m_width = 0;
m_height = 0;
if (m_pixmap) gdk_imlib_free_pixmap( m_pixmap );
#else
if (m_pixmap) gdk_pixmap_unref( m_pixmap );
+ if (m_bitmap) gdk_bitmap_unref( m_bitmap );
#endif
if (m_mask) delete m_mask;
if (m_palette) delete m_palette;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
-wxBitmap::wxBitmap( const int width, const int height, const int depth )
+wxBitmap::wxBitmap( int width, int height, int depth )
{
m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = NULL;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
-
-wxBitmap::wxBitmap( const wxString &filename, const int type )
+
+wxBitmap::wxBitmap( const wxString &filename, int type )
{
LoadFile( filename, type );
};
+// CMB 15/5/98: add constructor for xbm bitmaps
+wxBitmap::wxBitmap( const char bits[], int width, int height, int WXUNUSED(depth))
+{
+ m_refData = new wxBitmapRefData();
+
+ M_BMPDATA->m_mask = NULL;
+ M_BMPDATA->m_bitmap =
+ gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height );
+ gdk_window_get_size( M_BMPDATA->m_bitmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
+ M_BMPDATA->m_bpp = 1;
+
+ if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
+}
+
wxBitmap::~wxBitmap(void)
{
if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this);
return M_BMPDATA->m_bpp;
};
-void wxBitmap::SetHeight( const int height )
+void wxBitmap::SetHeight( int height )
{
if (!Ok()) return;
M_BMPDATA->m_height = height;
};
-void wxBitmap::SetWidth( const int width )
+void wxBitmap::SetWidth( int width )
{
if (!Ok()) return;
M_BMPDATA->m_width = width;
};
-void wxBitmap::SetDepth( const int depth )
+void wxBitmap::SetDepth( int depth )
{
if (!Ok()) return;
M_BMPDATA->m_bpp = depth;
M_BMPDATA->m_mask = mask;
};
-bool wxBitmap::SaveFile( const wxString &WXUNUSED(name), const int WXUNUSED(type),
+bool wxBitmap::SaveFile( const wxString &WXUNUSED(name), int WXUNUSED(type),
wxPalette *WXUNUSED(palette) )
{
return FALSE;
};
-bool wxBitmap::LoadFile( const wxString &name, const int WXUNUSED(type) )
+bool wxBitmap::LoadFile( const wxString &name, int WXUNUSED(type) )
{
#ifdef USE_GDK_IMLIB
return M_BMPDATA->m_pixmap;
};
+GdkBitmap *wxBitmap::GetBitmap(void) const
+{
+ if (!Ok()) return NULL;
+ return M_BMPDATA->m_bitmap;
+};
+