From: Robert Roebling Date: Sat, 5 Feb 2005 13:08:44 +0000 (+0000) Subject: Make wxBitmap inherit from wxBitmapBase X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4611dd06a1c5f016fd5b4c5384bbe4620f8af3e9?ds=inline Make wxBitmap inherit from wxBitmapBase git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h index 357c563685..f5f6b51ceb 100644 --- a/include/wx/bitmap.h +++ b/include/wx/bitmap.h @@ -34,6 +34,7 @@ class WXDLLEXPORT wxPalette; #if defined(__WXMGL__) || \ defined(__WXMAC__) || \ + defined(__WXGTK__) || \ defined(__WXCOCOA__) || \ defined(__WXMOTIF__) || \ defined(__WXX11__) diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 23f5b94e76..6ad8ede7d6 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -63,7 +63,7 @@ private: // wxBitmap //----------------------------------------------------------------------------- -class wxBitmap: public wxGDIObject +class wxBitmap: public wxBitmapBase { public: wxBitmap(); @@ -72,7 +72,7 @@ public: wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); } wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); } wxBitmap( const wxBitmap& bmp ); - wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM ); + wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM ); wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } ~wxBitmap(); wxBitmap& operator = ( const wxBitmap& bmp ); @@ -96,14 +96,17 @@ public: wxBitmap GetSubBitmap( const wxRect& rect ) const; - bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL ); - bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM ); + bool SaveFile(const wxString &name, wxBitmapType type, + const wxPalette *palette = (wxPalette *)NULL) const; + bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM ); +#if wxUSE_PALETTE wxPalette *GetPalette() const; + void SetPalette(const wxPalette& palette); wxPalette *GetColourMap() const { return GetPalette(); }; +#endif // wxUSE_PALETTE static void InitStandardHandlers() { } - static void CleanUpHandlers() { } // implementation // -------------- diff --git a/include/wx/gtk/icon.h b/include/wx/gtk/icon.h index c784b646e4..0bcbf462c0 100644 --- a/include/wx/gtk/icon.h +++ b/include/wx/gtk/icon.h @@ -38,7 +38,7 @@ public: // For compatibility with wxMSW where desired size is sometimes required to // distinguish between multiple icons in a resource. - wxIcon( const wxString& filename, int type = wxBITMAP_TYPE_XPM, + wxIcon( const wxString& filename, wxBitmapType type = wxBITMAP_TYPE_XPM, int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) : wxBitmap(filename, type) { diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 23f5b94e76..6ad8ede7d6 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -63,7 +63,7 @@ private: // wxBitmap //----------------------------------------------------------------------------- -class wxBitmap: public wxGDIObject +class wxBitmap: public wxBitmapBase { public: wxBitmap(); @@ -72,7 +72,7 @@ public: wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); } wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); } wxBitmap( const wxBitmap& bmp ); - wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM ); + wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM ); wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } ~wxBitmap(); wxBitmap& operator = ( const wxBitmap& bmp ); @@ -96,14 +96,17 @@ public: wxBitmap GetSubBitmap( const wxRect& rect ) const; - bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL ); - bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM ); + bool SaveFile(const wxString &name, wxBitmapType type, + const wxPalette *palette = (wxPalette *)NULL) const; + bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM ); +#if wxUSE_PALETTE wxPalette *GetPalette() const; + void SetPalette(const wxPalette& palette); wxPalette *GetColourMap() const { return GetPalette(); }; +#endif // wxUSE_PALETTE static void InitStandardHandlers() { } - static void CleanUpHandlers() { } // implementation // -------------- diff --git a/include/wx/gtk1/icon.h b/include/wx/gtk1/icon.h index c784b646e4..0bcbf462c0 100644 --- a/include/wx/gtk1/icon.h +++ b/include/wx/gtk1/icon.h @@ -38,7 +38,7 @@ public: // For compatibility with wxMSW where desired size is sometimes required to // distinguish between multiple icons in a resource. - wxIcon( const wxString& filename, int type = wxBITMAP_TYPE_XPM, + wxIcon( const wxString& filename, wxBitmapType type = wxBITMAP_TYPE_XPM, int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) : wxBitmap(filename, type) { diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 8a73768b7d..adf047670c 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -1153,12 +1153,12 @@ wxImage wxBitmap::ConvertToImage() const } wxBitmap::wxBitmap( const wxBitmap& bmp ) - : wxGDIObject() + : wxBitmapBase() { Ref( bmp ); } -wxBitmap::wxBitmap( const wxString &filename, int type ) +wxBitmap::wxBitmap( const wxString &filename, wxBitmapType type ) { LoadFile( filename, type ); } @@ -1324,7 +1324,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const return ret; } -bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(palette) ) +bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalette *WXUNUSED(palette) ) const { wxCHECK_MSG( Ok(), FALSE, wxT("invalid bitmap") ); @@ -1337,7 +1337,7 @@ bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(pal return FALSE; } -bool wxBitmap::LoadFile( const wxString &name, int type ) +bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) { UnRef(); @@ -1390,6 +1390,11 @@ wxPalette *wxBitmap::GetPalette() const return M_BMPDATA->m_palette; } +void wxBitmap::SetPalette(const wxPalette& WXUNUSED(palette)) +{ + // TODO +} + void wxBitmap::SetHeight( int height ) { if (!m_refData) diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 8a73768b7d..adf047670c 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -1153,12 +1153,12 @@ wxImage wxBitmap::ConvertToImage() const } wxBitmap::wxBitmap( const wxBitmap& bmp ) - : wxGDIObject() + : wxBitmapBase() { Ref( bmp ); } -wxBitmap::wxBitmap( const wxString &filename, int type ) +wxBitmap::wxBitmap( const wxString &filename, wxBitmapType type ) { LoadFile( filename, type ); } @@ -1324,7 +1324,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const return ret; } -bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(palette) ) +bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalette *WXUNUSED(palette) ) const { wxCHECK_MSG( Ok(), FALSE, wxT("invalid bitmap") ); @@ -1337,7 +1337,7 @@ bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(pal return FALSE; } -bool wxBitmap::LoadFile( const wxString &name, int type ) +bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) { UnRef(); @@ -1390,6 +1390,11 @@ wxPalette *wxBitmap::GetPalette() const return M_BMPDATA->m_palette; } +void wxBitmap::SetPalette(const wxPalette& WXUNUSED(palette)) +{ + // TODO +} + void wxBitmap::SetHeight( int height ) { if (!m_refData)