#include "wx/wxprec.h"
#include "wx/bitmap.h"
-#include "wx/icon.h"
-#include "wx/log.h"
-#include "wx/image.h"
-#include "wx/app.h"
-#if wxUSE_NANOX
-#include "wx/dcmemory.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+ #include "wx/app.h"
+ #include "wx/dcmemory.h"
+ #include "wx/icon.h"
+ #include "wx/math.h"
+ #include "wx/image.h"
#endif
#include "wx/x11/private.h"
#include "wx/wfstream.h"
#endif
#endif
-#include "wx/math.h"
//-----------------------------------------------------------------------------
// wxMask
{
public:
wxBitmapRefData();
- ~wxBitmapRefData();
+ virtual ~wxBitmapRefData();
WXPixmap m_pixmap;
WXPixmap m_bitmap;
{
UnRef();
- wxCHECK_MSG( (width > 0) && (height > 0), false, wxT("invalid bitmap size") )
+ wxCHECK_MSG( (width > 0) && (height > 0), false, wxT("invalid bitmap size") );
m_refData = new wxBitmapRefData();
if (depth == -1) depth = bpp;
wxCHECK_MSG( (depth == bpp) ||
- (depth == 1), false, wxT("invalid bitmap depth") )
+ (depth == 1), false, wxT("invalid bitmap depth") );
M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_width = width;
return Ok();
}
-bool wxBitmap::Create(void *data, wxBitmapType type,
+bool wxBitmap::Create(const void* data, wxBitmapType type,
int width, int height, int depth)
{
UnRef();
return true;
}
-bool wxBitmap::CreateFromXpm( const char **bits )
+wxBitmap::wxBitmap(const char* const* bits)
{
- wxCHECK_MSG( bits, false, wxT("NULL pointer in wxBitmap::CreateFromXpm") );
-
- return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
+ Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
UnRef();
- wxCHECK_MSG( image.Ok(), false, wxT("invalid image") )
- wxCHECK_MSG( depth == -1, false, wxT("invalid bitmap depth") )
+ wxCHECK_MSG( image.Ok(), false, wxT("invalid image") );
+ wxCHECK_MSG( depth == -1, false, wxT("invalid bitmap depth") );
m_refData = new wxBitmapRefData();
// wxUSE_NANOX
}
-wxBitmap::wxBitmap( const wxBitmap& bmp )
-{
- Ref( bmp );
-}
-
wxBitmap::wxBitmap( const wxString &filename, wxBitmapType type )
{
LoadFile( filename, type );
{
m_refData = new wxBitmapRefData;
- (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, depth);
+ (void) Create(bits, wxBITMAP_TYPE_XBM_DATA, width, height, depth);
}
wxBitmap::~wxBitmap()
{
}
-wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp )
-{
- if ( m_refData != bmp.m_refData )
- Ref( bmp );
-
- return *this;
-}
-
bool wxBitmap::operator == ( const wxBitmap& bmp ) const
{
return m_refData == bmp.m_refData;
return m_refData != bmp.m_refData;
}
-bool wxBitmap::Ok() const
+bool wxBitmap::IsOk() const
{
return (m_refData != NULL);
}
// Bitmap handlers
// ============================================================================
-IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase);
+IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
#define M_BMPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData())
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL);
- virtual bool Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(flags),
+ virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data), long WXUNUSED(flags),
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth) = 1)
{ return false; }
};
-IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler);
+IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
long WXUNUSED(flags), int WXUNUSED(desiredWidth),
const wxPalette *WXUNUSED(palette) = NULL)
{ return false; }
- virtual bool Create(wxBitmap *bitmap, void *data, long flags,
+ virtual bool Create(wxBitmap *bitmap, const void* data, long flags,
int width, int height, int depth = 1);
};
-IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler);
+IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
-bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *bits,
+bool wxXPMDataHandler::Create(wxBitmap *bitmap, const void* bits,
long WXUNUSED(flags),
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth))
{
#if wxHAVE_LIB_XPM
- wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") )
+ wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
if (!bitmap->GetRefData())
bitmap->SetRefData( new wxBitmapRefData() );
const wxPalette *WXUNUSED(palette) = NULL)
{ return false; }
- virtual bool Create(wxBitmap *bitmap, void *data, long flags,
+ virtual bool Create(wxBitmap *bitmap, const void* data, long flags,
int width, int height, int depth = 1);
};
-IMPLEMENT_DYNAMIC_CLASS(wxXBMDataHandler, wxBitmapHandler);
+IMPLEMENT_DYNAMIC_CLASS(wxXBMDataHandler, wxBitmapHandler)
-bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *bits,
+bool wxXBMDataHandler::Create( wxBitmap *bitmap, const void* bits,
long WXUNUSED(flags),
int width, int height, int WXUNUSED(depth))
{