]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/bitmap.cpp
use WX_DEFINE_ARRAY_INT for an array of ints (bug 1536482)
[wxWidgets.git] / src / gtk1 / bitmap.cpp
index e382abbec1dc6168de9c1a928e4de2175549a389..1e7534bcc2c80ff05b310f6be3e10ee27a15d32f 100644 (file)
 #include "wx/wxprec.h"
 
 #include "wx/bitmap.h"
-#include "wx/palette.h"
-#include "wx/icon.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/dcmemory.h"
+    #include "wx/palette.h"
+    #include "wx/icon.h"
+    #include "wx/math.h"
+    #include "wx/image.h"
+#endif // WX_PRECOMP
+
 #include "wx/filefn.h"
-#include "wx/image.h"
-#include "wx/dcmemory.h"
-#include "wx/app.h"
 
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
@@ -24,8 +29,6 @@
 
 #include <gdk/gdkrgb.h>
 
-#include "wx/math.h"
-
 extern
 void gdk_wx_draw_bitmap (GdkDrawable  *drawable,
                          GdkGC        *gc,
@@ -225,7 +228,7 @@ class wxBitmapRefData: public wxObjectRefData
 {
 public:
     wxBitmapRefData();
-    ~wxBitmapRefData();
+    virtual ~wxBitmapRefData();
 
     GdkPixmap      *m_pixmap;
     GdkBitmap      *m_bitmap;
@@ -309,11 +312,9 @@ bool wxBitmap::Create( int width, int height, int depth )
     return Ok();
 }
 
-bool wxBitmap::CreateFromXpm( const char **bits )
+wxBitmap::wxBitmap(const char* const* bits)
 {
-    UnRef();
-
-    wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
+    wxCHECK2_MSG(bits != NULL, return, wxT("invalid bitmap data"));
 
     GdkVisual *visual = wxTheApp->GetGdkVisual();
 
@@ -323,7 +324,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
 
     M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( wxGetRootWindow()->window, &mask, NULL, (gchar **) bits );
 
-    wxCHECK_MSG( M_BMPDATA->m_pixmap, false, wxT("couldn't create pixmap") );
+    wxCHECK2_MSG(M_BMPDATA->m_pixmap, return, wxT("couldn't create pixmap"));
 
     if (mask)
     {
@@ -334,8 +335,6 @@ bool wxBitmap::CreateFromXpm( const char **bits )
     gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
 
     M_BMPDATA->m_bpp = visual->depth;  // Can we get a different depth from create_from_xpm_d() ?
-
-    return true;
 }
 
 wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, int newx, int newy )
@@ -1077,7 +1076,7 @@ bool wxBitmap::operator != ( const wxBitmap& bmp ) const
     return m_refData != bmp.m_refData;
 }
 
-bool wxBitmap::Ok() const
+bool wxBitmap::IsOk() const
 {
     return (m_refData != NULL) &&
            (M_BMPDATA->m_bitmap || M_BMPDATA->m_pixmap);
@@ -1317,7 +1316,6 @@ void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data))
 {
 }
 
-
 bool wxBitmap::HasAlpha() const
 {
     return false;
@@ -1331,44 +1329,7 @@ void wxBitmap::UseAlpha()
 // wxBitmapHandler
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler,wxBitmapHandlerBase)
-
-wxBitmapHandler::~wxBitmapHandler()
-{
-}
-
-bool wxBitmapHandler::Create(wxBitmap * WXUNUSED(bitmap),
-                             void * WXUNUSED(data),
-                             long WXUNUSED(type),
-                             int WXUNUSED(width),
-                             int WXUNUSED(height),
-                             int WXUNUSED(depth))
-{
-    wxFAIL_MSG( _T("not implemented") );
-
-    return false;
-}
-
-bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
-                               const wxString& WXUNUSED(name),
-                               long WXUNUSED(flags),
-                               int WXUNUSED(desiredWidth),
-                               int WXUNUSED(desiredHeight))
-{
-    wxFAIL_MSG( _T("not implemented") );
-
-    return false;
-}
-
-bool wxBitmapHandler::SaveFile(const wxBitmap * WXUNUSED(bitmap),
-                               const wxString& WXUNUSED(name),
-                               int WXUNUSED(type),
-                               const wxPalette * WXUNUSED(palette))
-{
-    wxFAIL_MSG( _T("not implemented") );
-
-    return false;
-}
+IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
 
 /* static */ void wxBitmap::InitStandardHandlers()
 {