From e86f2cc84aabc8a58b1984c1ed7fb9475f6abe67 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Tue, 25 Mar 2008 20:31:48 +0000 Subject: [PATCH] reorganized wxBitmap/wxBitmapHandler classes to use wxBitmapType instead of "long" where possible; made them const-correct; introduce wxBITMAP_SCREEN_DEPTH instead of -1 for clearness (specially in the docs); remove wxBitmapHandler empty stubs and rename wxBitmapHandlerBase as wxBitmapHandler git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/bitmap.h | 60 ++++++++++++++++------- include/wx/cocoa/bitmap.h | 6 +-- include/wx/dfb/bitmap.h | 8 +--- include/wx/gtk/bitmap.h | 23 +++------ include/wx/gtk1/bitmap.h | 8 ---- include/wx/mac/carbon/bitmap.h | 5 -- include/wx/mgl/bitmap.h | 5 -- include/wx/msw/bitmap.h | 59 ++++++++++++----------- include/wx/msw/gdiimage.h | 87 ++++++++++++++++------------------ include/wx/msw/icon.h | 4 +- include/wx/os2/bitmap.h | 14 +++--- include/wx/x11/bitmap.h | 5 -- src/common/bmpbase.cpp | 17 +------ src/gtk/bitmap.cpp | 6 --- src/gtk1/bitmap.cpp | 6 --- src/mac/carbon/bitmap.cpp | 6 --- src/mgl/bitmap.cpp | 2 - src/msw/bitmap.cpp | 34 ++++++------- src/msw/gdiimage.cpp | 40 ++++++++-------- src/msw/icon.cpp | 6 +-- src/os2/bitmap.cpp | 17 ++++--- src/x11/bitmap.cpp | 2 - 22 files changed, 184 insertions(+), 236 deletions(-) diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h index bd81349e36..6d3d323c4b 100644 --- a/include/wx/bitmap.h +++ b/include/wx/bitmap.h @@ -40,6 +40,8 @@ DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT) // wxMask represents the transparent area of the bitmap // ---------------------------------------------------------------------------- +// TODO: all implementation of wxMask, except the generic one, +// do not derive from wxMaskBase,,, they should class WXDLLEXPORT wxMaskBase : public wxObject { public: @@ -78,8 +80,13 @@ protected: #define wxUSE_BITMAP_BASE 0 #endif -// Only used by some ports -// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes +// a more readable way to tell +#define wxBITMAP_SCREEN_DEPTH (-1) + + +// All ports except wxMSW,wxOS2,wxPalmOS use wxBitmapHandler and wxBitmapBase as base class +// for wxBitmapHandler; wxMSW,wxOS2,wxPalmOS use wxGDIImageHandler as base class +// since it allows some code reuse there. #if wxUSE_BITMAP_BASE // ---------------------------------------------------------------------------- @@ -87,18 +94,29 @@ protected: // different formats // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxBitmapHandlerBase : public wxObject +class WXDLLEXPORT wxBitmapHandler : public wxObject { public: - wxBitmapHandlerBase() { m_type = wxBITMAP_TYPE_INVALID; } - virtual ~wxBitmapHandlerBase() { } + wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; } + virtual ~wxBitmapHandler() { } + + // NOTE: the following functions should be pure virtuals, but they aren't + // because otherwise almost all ports would have to implement + // them as "return false"... - virtual bool Create(wxBitmap *bitmap, const void* data, long flags, - int width, int height, int depth = 1); - virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight); - virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, - int type, const wxPalette *palette = NULL); + virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data), + wxBitmapType WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(depth) = 1) + { return false; } + + virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), + wxBitmapType WXUNUSED(type), int WXUNUSED(desiredWidth), + int WXUNUSED(desiredHeight)) + { return false; } + + virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), + wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = NULL) const + { return false; } void SetName(const wxString& name) { m_name = name; } void SetExtension(const wxString& ext) { m_extension = ext; } @@ -112,9 +130,14 @@ private: wxString m_extension; wxBitmapType m_type; - DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase) + DECLARE_ABSTRACT_CLASS(wxBitmapHandler) }; + +// ---------------------------------------------------------------------------- +// wxBitmap: class which represents platform-dependent bitmap (unlike wxImage) +// ---------------------------------------------------------------------------- + class WXDLLEXPORT wxBitmapBase : public wxGDIObject { public: @@ -122,17 +145,18 @@ public: Derived class must implement these: wxBitmap(); - wxBitmap(int width, int height, int depth = -1); + wxBitmap(const wxBitmap& bmp); wxBitmap(const char bits[], int width, int height, int depth = 1); + wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); wxBitmap(const char* const* bits); wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM); - wxBitmap(const wxImage& image, int depth = -1); - - bool Create(int width, int height, int depth = -1); + wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH); static void InitStandardHandlers(); */ + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0; + virtual int GetHeight() const = 0; virtual int GetWidth() const = 0; virtual int GetDepth() const = 0; @@ -173,8 +197,8 @@ public: // Format handling static inline wxList& GetHandlers() { return sm_handlers; } - static void AddHandler(wxBitmapHandlerBase *handler); - static void InsertHandler(wxBitmapHandlerBase *handler); + static void AddHandler(wxBitmapHandler *handler); + static void InsertHandler(wxBitmapHandler *handler); static bool RemoveHandler(const wxString& name); static wxBitmapHandler *FindHandler(const wxString& name); static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType); diff --git a/include/wx/cocoa/bitmap.h b/include/wx/cocoa/bitmap.h index 79d0c6279d..c7fc972c1c 100644 --- a/include/wx/cocoa/bitmap.h +++ b/include/wx/cocoa/bitmap.h @@ -135,7 +135,7 @@ public: wxMask *GetMask() const; void SetMask(wxMask *mask) ; - int GetBitmapType() const; + wxBitmapType GetBitmapType() const; // wxCocoa WX_NSBitmapImageRep GetNSBitmapImageRep(); @@ -152,9 +152,5 @@ protected: DECLARE_DYNAMIC_CLASS(wxBitmap) }; -class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase -{ - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) -}; #endif // __WX_COCOA_BITMAP_H__ diff --git a/include/wx/dfb/bitmap.h b/include/wx/dfb/bitmap.h index 7ac7cf2b2e..38ddc08405 100644 --- a/include/wx/dfb/bitmap.h +++ b/include/wx/dfb/bitmap.h @@ -21,11 +21,6 @@ wxDFB_DECLARE_INTERFACE(IDirectFBSurface); // wxBitmap //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapHandler : public wxBitmapHandlerBase -{ - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) -}; - class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase { public: @@ -55,7 +50,8 @@ public: virtual wxBitmap GetSubBitmap(const wxRect& rect) const; - virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const; + virtual bool SaveFile(const wxString &name, wxBitmapType type, + const wxPalette *palette = (wxPalette *) NULL) const; virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); #if wxUSE_PALETTE diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 5cc7ed1c1c..fcecd810b9 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -51,23 +51,22 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase { public: wxBitmap() { } - wxBitmap( int width, int height, int depth = -1 ); + wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH ); wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char* const* bits ); #ifdef wxNEEDS_CHARPP // needed for old GCC wxBitmap(char** data) - { - *this = wxBitmap(wx_const_cast(const char* const*, data)); - } + { *this = wxBitmap(wx_const_cast(const char* const*, data)); } #endif wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM ); #if wxUSE_IMAGE - wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } + wxBitmap( const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH ) + { (void)CreateFromImage(image, depth); } #endif // wxUSE_IMAGE virtual ~wxBitmap(); - bool Create(int width, int height, int depth = -1); + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); virtual int GetHeight() const; virtual int GetWidth() const; @@ -112,7 +111,8 @@ public: GdkPixbuf *GetPixbuf() const; // Basically, this corresponds to Win32 StretchBlt() - wxBitmap Rescale(int clipx, int clipy, int clipwidth, int clipheight, int width, int height) const; + wxBitmap Rescale(int clipx, int clipy, int clipwidth, int clipheight, + int width, int height) const; // raw bitmap access support functions void *GetRawData(wxPixelDataBase& data, int bpp); @@ -150,13 +150,4 @@ private: DECLARE_DYNAMIC_CLASS(wxBitmap) }; -//----------------------------------------------------------------------------- -// wxBitmapHandler -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase -{ - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) -}; - #endif // _WX_GTK_BITMAP_H_ diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 090b72e73c..633f2157cd 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -146,13 +146,5 @@ private: DECLARE_DYNAMIC_CLASS(wxBitmap) }; -//----------------------------------------------------------------------------- -// wxBitmapHandler -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase -{ - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) -}; #endif // __GTKBITMAPH__ diff --git a/include/wx/mac/carbon/bitmap.h b/include/wx/mac/carbon/bitmap.h index 96664c2129..40ad96f232 100644 --- a/include/wx/mac/carbon/bitmap.h +++ b/include/wx/mac/carbon/bitmap.h @@ -80,11 +80,6 @@ private: }; -class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase -{ - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) -}; - class WXDLLEXPORT wxBitmap: public wxBitmapBase { DECLARE_DYNAMIC_CLASS(wxBitmap) diff --git a/include/wx/mgl/bitmap.h b/include/wx/mgl/bitmap.h index 60bfc1c335..0d14a1cc51 100644 --- a/include/wx/mgl/bitmap.h +++ b/include/wx/mgl/bitmap.h @@ -23,11 +23,6 @@ struct bitmap_t; // wxBitmap //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase -{ - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) -}; - class WXDLLEXPORT wxBitmap: public wxBitmapBase { public: diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index 176eb45edb..7525ca1b3f 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -41,6 +41,7 @@ enum wxBitmapTransparency // ---------------------------------------------------------------------------- // wxBitmap: a mono or colour bitmap +// NOTE: for wxMSW we don't use the wxBitmapBase base class declared in bitmap.h! // ---------------------------------------------------------------------------- class WXDLLEXPORT wxBitmap : public wxGDIImage @@ -65,7 +66,7 @@ public: wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); // New constructor for generalised creation from data - wxBitmap(const void* data, long type, int width, int height, int depth = 1); + wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); // Create a new, uninitialized bitmap of the given size and depth (if it // is omitted, will create a bitmap compatible with the display) @@ -135,11 +136,11 @@ public: bool CopyFromDIB(const wxDIB& dib); #endif - virtual bool Create(int width, int height, int depth = -1); + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); virtual bool Create(int width, int height, const wxDC& dc); - virtual bool Create(const void* data, long type, int width, int height, int depth = 1); - virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE); - virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); + virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); + virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); + virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; wxBitmapRefData *GetBitmapData() const { return (wxBitmapRefData *)m_refData; } @@ -244,45 +245,49 @@ protected: DECLARE_DYNAMIC_CLASS(wxMask) }; + // ---------------------------------------------------------------------------- // wxBitmapHandler is a class which knows how to load/save bitmaps to/from file +// NOTE: for wxMSW we don't use the wxBitmapHandler class declared in bitmap.h! // ---------------------------------------------------------------------------- class WXDLLEXPORT wxBitmapHandler : public wxGDIImageHandler { public: wxBitmapHandler() { } - wxBitmapHandler(const wxString& name, const wxString& ext, long type) - : wxGDIImageHandler(name, ext, type) - { - } + wxBitmapHandler(const wxString& name, const wxString& ext, wxBitmapType type) + : wxGDIImageHandler(name, ext, type) { } - // keep wxBitmapHandler derived from wxGDIImageHandler compatible with the - // old class which worked only with bitmaps - virtual bool Create(wxBitmap *bitmap, - const void* data, - long flags, - int width, int height, int depth = 1); - virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, - long flags, - int desiredWidth, int desiredHeight); - virtual bool SaveFile(wxBitmap *bitmap, - const wxString& name, - int type, - const wxPalette *palette = NULL); + // implement wxGDIImageHandler's pure virtuals: virtual bool Create(wxGDIImage *image, const void* data, - long flags, + wxBitmapType type, int width, int height, int depth = 1); virtual bool Load(wxGDIImage *image, const wxString& name, - long flags, + wxBitmapType type, int desiredWidth, int desiredHeight); - virtual bool Save(wxGDIImage *image, + virtual bool Save(const wxGDIImage *image, const wxString& name, - int type); + wxBitmapType type) const; + + + // make wxBitmapHandler compatible with the wxBitmapHandler interface + // declared in bitmap.h, even if it's derived from wxGDIImageHandler: + + virtual bool Create(wxBitmap *bitmap, + const void* data, + wxBitmapType type, + int width, int height, int depth = 1); + virtual bool LoadFile(wxBitmap *bitmap, + const wxString& name, + wxBitmapType type, + int desiredWidth, int desiredHeight); + virtual bool SaveFile(const wxBitmap *bitmap, + const wxString& name, + wxBitmapType type, + const wxPalette *palette = NULL) const; private: DECLARE_DYNAMIC_CLASS(wxBitmapHandler) diff --git a/include/wx/msw/gdiimage.h b/include/wx/msw/gdiimage.h index 2a085f319f..9557a9c8e7 100644 --- a/include/wx/msw/gdiimage.h +++ b/include/wx/msw/gdiimage.h @@ -76,51 +76,6 @@ public: }; }; -// ---------------------------------------------------------------------------- -// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxGDIImageHandler : public wxObject -{ -public: - // ctor - wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } - wxGDIImageHandler(const wxString& name, - const wxString& ext, - long type) - : m_name(name), m_extension(ext) - { - m_type = type; - } - - // accessors - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(long type) { m_type = type; } - - const wxString& GetName() const { return m_name; } - const wxString& GetExtension() const { return m_extension; } - long GetType() const { return m_type; } - - // real handler operations: to implement in derived classes - virtual bool Create(wxGDIImage *image, - const void* data, - long flags, - int width, int height, int depth = 1) = 0; - virtual bool Load(wxGDIImage *image, - const wxString& name, - long flags, - int desiredWidth, int desiredHeight) = 0; - virtual bool Save(wxGDIImage *image, - const wxString& name, - int type) = 0; - -protected: - wxString m_name; - wxString m_extension; - long m_type; -}; - // ---------------------------------------------------------------------------- // wxGDIImage: this class supports GDI image handlers which may be registered // dynamically and will be used for loading/saving the images in the specified @@ -192,4 +147,46 @@ protected: static wxGDIImageHandlerList ms_handlers; }; +// ---------------------------------------------------------------------------- +// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIImageHandler : public wxObject +{ +public: + // ctor + wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } + wxGDIImageHandler(const wxString& name, + const wxString& ext, + wxBitmapType type) + : m_name(name), m_extension(ext), m_type(type) { } + + // accessors + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(wxBitmapType type) { m_type = type; } + + const wxString& GetName() const { return m_name; } + const wxString& GetExtension() const { return m_extension; } + wxBitmapType GetType() const { return m_type; } + + // real handler operations: to implement in derived classes + virtual bool Create(wxGDIImage *image, + const void* data, + wxBitmapType flags, + int width, int height, int depth = 1) = 0; + virtual bool Load(wxGDIImage *image, + const wxString& name, + wxBitmapType flags, + int desiredWidth, int desiredHeight) = 0; + virtual bool Save(const wxGDIImage *image, + const wxString& name, + wxBitmapType type) const = 0; + +protected: + wxString m_name; + wxString m_extension; + wxBitmapType m_type; +}; + #endif // _WX_MSW_GDIIMAGE_H_ diff --git a/include/wx/msw/icon.h b/include/wx/msw/icon.h index 7984f79d37..45ef0fd34b 100644 --- a/include/wx/msw/icon.h +++ b/include/wx/msw/icon.h @@ -54,7 +54,7 @@ public: #endif // from resource/file wxIcon(const wxString& name, - long type = wxBITMAP_TYPE_ICO_RESOURCE, + wxBitmapType type = wxBITMAP_TYPE_ICO_RESOURCE, int desiredWidth = -1, int desiredHeight = -1); wxIcon(const wxIconLocation& loc); @@ -62,7 +62,7 @@ public: virtual ~wxIcon(); virtual bool LoadFile(const wxString& name, - long type = wxBITMAP_TYPE_ICO_RESOURCE, + wxBitmapType type = wxBITMAP_TYPE_ICO_RESOURCE, int desiredWidth = -1, int desiredHeight = -1); // implementation only from now on diff --git a/include/wx/os2/bitmap.h b/include/wx/os2/bitmap.h index 2431cd3360..bf8e889528 100644 --- a/include/wx/os2/bitmap.h +++ b/include/wx/os2/bitmap.h @@ -287,7 +287,7 @@ public: inline wxBitmapHandler( const wxString& rName ,const wxString& rExt - ,long lType + ,wxBitmapType lType ) : wxGDIImageHandler( rName ,rExt @@ -299,28 +299,28 @@ public: // old class which worked only with bitmaps virtual bool Create( wxBitmap* pBitmap ,const void* pData - ,long lFlags + ,wxBitmapType lType ,int nWidth ,int nHeight ,int nDepth = 1 ); virtual bool LoadFile( wxBitmap* pBitmap ,int nId - ,long lFlags + ,wxBitmapType lType ,int nDesiredWidth ,int nDesiredHeight ); virtual bool LoadFile( wxBitmap* pBitmap ,const wxString& rName - ,long lFlags + ,wxBitmapType lType ,int nDesiredWidth ,int nDesiredHeight ); virtual bool SaveFile( wxBitmap* pBitmap ,const wxString& rName - ,int lType + ,wxBitmapType lType ,const wxPalette* pPalette = NULL - ); + ) const; virtual bool Create( wxGDIImage* pImage ,const void* pData @@ -338,7 +338,7 @@ public: virtual bool Save( wxGDIImage* pImage ,const wxString& rName ,int lType - ); + ) const; private: inline virtual bool Load( wxGDIImage* WXUNUSED(pImage) ,const wxString& WXUNUSED(rName) diff --git a/include/wx/x11/bitmap.h b/include/wx/x11/bitmap.h index 29572c4870..4ad700eb11 100644 --- a/include/wx/x11/bitmap.h +++ b/include/wx/x11/bitmap.h @@ -62,11 +62,6 @@ private: // wxBitmap //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase -{ - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) -}; - class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase { public: diff --git a/src/common/bmpbase.cpp b/src/common/bmpbase.cpp index 8c940d21b0..2f0776eaca 100644 --- a/src/common/bmpbase.cpp +++ b/src/common/bmpbase.cpp @@ -47,7 +47,7 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxIcon,WXDLLEXPORT) IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase, wxGDIObject) -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase,wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxObject) wxList wxBitmapBase::sm_handlers; @@ -126,21 +126,6 @@ void wxBitmapBase::CleanUpHandlers() } } -bool wxBitmapHandlerBase::Create(wxBitmap*, const void*, long, int, int, int) -{ - return false; -} - -bool wxBitmapHandlerBase::LoadFile(wxBitmap*, const wxString&, long, int, int) -{ - return false; -} - -bool wxBitmapHandlerBase::SaveFile(const wxBitmap*, const wxString&, int, const wxPalette*) -{ - return false; -} - class wxBitmapBaseModule: public wxModule { DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule) diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 91aa96accf..b1fe2f76f1 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -968,12 +968,6 @@ wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const return newRef; } -//----------------------------------------------------------------------------- -// wxBitmapHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) - /* static */ void wxBitmap::InitStandardHandlers() { // TODO: Insert handler based on GdkPixbufs handler later diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index daa51e4dc5..be9243096d 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -1373,12 +1373,6 @@ bool wxBitmap::HasAlpha() const return false; } -//----------------------------------------------------------------------------- -// wxBitmapHandler -//----------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) - /* static */ void wxBitmap::InitStandardHandlers() { // TODO: Insert handler based on GdkPixbufs handler later diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 19334a0f7c..9608e346ef 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -1615,12 +1615,6 @@ WXHBITMAP wxMask::GetHBITMAP() const return m_maskBitmap ; } -// ---------------------------------------------------------------------------- -// wxBitmapHandler -// ---------------------------------------------------------------------------- - -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) - // ---------------------------------------------------------------------------- // Standard Handlers // ---------------------------------------------------------------------------- diff --git a/src/mgl/bitmap.cpp b/src/mgl/bitmap.cpp index c280b0b0ac..65294d62c6 100644 --- a/src/mgl/bitmap.cpp +++ b/src/mgl/bitmap.cpp @@ -92,8 +92,6 @@ wxBitmapRefData::~wxBitmapRefData() #define M_BMPDATA ((wxBitmapRefData *)m_refData) - -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase) wxBitmap::wxBitmap(int width, int height, int depth) diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 725d5fd0cb..0dd6a215ca 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -520,14 +520,14 @@ wxBitmap::wxBitmap(int w, int h, const wxDC& dc) (void)Create(w, h, dc); } -wxBitmap::wxBitmap(const void* data, long type, int width, int height, int depth) +wxBitmap::wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth) { (void)Create(data, type, width, height, depth); } wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) { - LoadFile(filename, (int)type); + LoadFile(filename, type); } bool wxBitmap::Create(int width, int height, int depth) @@ -1027,7 +1027,7 @@ wxImage wxBitmap::ConvertToImage() const // loading and saving bitmaps // ---------------------------------------------------------------------------- -bool wxBitmap::LoadFile(const wxString& filename, long type) +bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type) { UnRef(); @@ -1055,7 +1055,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type) return false; } -bool wxBitmap::Create(const void* data, long type, int width, int height, int depth) +bool wxBitmap::Create(const void* data, wxBitmapType type, int width, int height, int depth) { UnRef(); @@ -1074,8 +1074,8 @@ bool wxBitmap::Create(const void* data, long type, int width, int height, int de } bool wxBitmap::SaveFile(const wxString& filename, - int type, - const wxPalette *palette) + wxBitmapType type, + const wxPalette *palette) const { wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler); @@ -1563,27 +1563,27 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) bool wxBitmapHandler::Create(wxGDIImage *image, const void* data, - long flags, + wxBitmapType type, int width, int height, int depth) { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - return bitmap && Create(bitmap, data, flags, width, height, depth); + return bitmap && Create(bitmap, data, type, width, height, depth); } bool wxBitmapHandler::Load(wxGDIImage *image, const wxString& name, - long flags, + wxBitmapType type, int width, int height) { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - return bitmap && LoadFile(bitmap, name, flags, width, height); + return bitmap && LoadFile(bitmap, name, type, width, height); } -bool wxBitmapHandler::Save(wxGDIImage *image, +bool wxBitmapHandler::Save(const wxGDIImage *image, const wxString& name, - int type) + wxBitmapType type) const { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); @@ -1592,7 +1592,7 @@ bool wxBitmapHandler::Save(wxGDIImage *image, bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data), - long WXUNUSED(type), + wxBitmapType WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth)) @@ -1602,17 +1602,17 @@ bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), - long WXUNUSED(type), + wxBitmapType WXUNUSED(type), int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { return false; } -bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), +bool wxBitmapHandler::SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), - int WXUNUSED(type), - const wxPalette *WXUNUSED(palette)) + wxBitmapType WXUNUSED(type), + const wxPalette *WXUNUSED(palette)) const { return false; } diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index ff89f0755b..910d6c90b5 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -67,11 +67,11 @@ public: } virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, long flags, + const wxString& name, wxBitmapType flags, int desiredWidth, int desiredHeight); - virtual bool SaveFile(wxBitmap *bitmap, - const wxString& name, int type, - const wxPalette *palette = NULL); + virtual bool SaveFile(const wxBitmap *bitmap, + const wxString& name, wxBitmapType type, + const wxPalette *palette = NULL) const; private: DECLARE_DYNAMIC_CLASS(wxBMPFileHandler) @@ -87,7 +87,7 @@ public: } virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, long flags, + const wxString& name, wxBitmapType flags, int desiredWidth, int desiredHeight); private: @@ -97,7 +97,7 @@ private: class WXDLLEXPORT wxIconHandler : public wxGDIImageHandler { public: - wxIconHandler(const wxString& name, const wxString& ext, long type) + wxIconHandler(const wxString& name, const wxString& ext, wxBitmapType type) : wxGDIImageHandler(name, ext, type) { } @@ -105,7 +105,7 @@ public: // creating and saving icons is not supported virtual bool Create(wxGDIImage *WXUNUSED(image), const void* WXUNUSED(data), - long WXUNUSED(flags), + wxBitmapType WXUNUSED(flags), int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth) = 1) @@ -113,16 +113,16 @@ public: return false; } - virtual bool Save(wxGDIImage *WXUNUSED(image), + virtual bool Save(const wxGDIImage *WXUNUSED(image), const wxString& WXUNUSED(name), - int WXUNUSED(type)) + wxBitmapType WXUNUSED(type)) const { return false; } virtual bool Load(wxGDIImage *image, const wxString& name, - long flags, + wxBitmapType flags, int desiredWidth, int desiredHeight) { wxIcon *icon = wxDynamicCast(image, wxIcon); @@ -133,7 +133,7 @@ public: protected: virtual bool LoadIcon(wxIcon *icon, - const wxString& name, long flags, + const wxString& name, wxBitmapType flags, int desiredWidth = -1, int desiredHeight = -1) = 0; }; @@ -148,7 +148,7 @@ public: protected: virtual bool LoadIcon(wxIcon *icon, - const wxString& name, long flags, + const wxString& name, wxBitmapType flags, int desiredWidth = -1, int desiredHeight = -1); private: @@ -166,7 +166,7 @@ public: protected: virtual bool LoadIcon(wxIcon *icon, - const wxString& name, long flags, + const wxString& name, wxBitmapType flags, int desiredWidth = -1, int desiredHeight = -1); private: @@ -318,7 +318,7 @@ void wxGDIImage::InitStandardHandlers() // ---------------------------------------------------------------------------- bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, - const wxString& name, long WXUNUSED(flags), + const wxString& name, wxBitmapType WXUNUSED(flags), int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { @@ -351,7 +351,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, } bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, - const wxString& name, long WXUNUSED(flags), + const wxString& name, wxBitmapType WXUNUSED(flags), int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { @@ -366,10 +366,10 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, #endif } -bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, +bool wxBMPFileHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, - int WXUNUSED(type), - const wxPalette * WXUNUSED(pal)) + wxBitmapType WXUNUSED(type), + const wxPalette * WXUNUSED(pal)) const { #if wxUSE_WXDIB wxCHECK_MSG( bitmap, false, _T("NULL bitmap in SaveFile") ); @@ -388,7 +388,7 @@ bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, bool wxICOFileHandler::LoadIcon(wxIcon *icon, const wxString& name, - long WXUNUSED(flags), + wxBitmapType WXUNUSED(flags), int desiredWidth, int desiredHeight) { icon->UnRef(); @@ -499,7 +499,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, bool wxICOResourceHandler::LoadIcon(wxIcon *icon, const wxString& name, - long WXUNUSED(flags), + wxBitmapType WXUNUSED(flags), int desiredWidth, int desiredHeight) { HICON hicon; diff --git a/src/msw/icon.cpp b/src/msw/icon.cpp index ee899f2b8a..14d2029349 100644 --- a/src/msw/icon.cpp +++ b/src/msw/icon.cpp @@ -72,12 +72,12 @@ wxIcon::wxIcon(const char bits[], int width, int height) } wxIcon::wxIcon(const wxString& iconfile, - long flags, + wxBitmapType type, int desiredWidth, int desiredHeight) { - LoadFile(iconfile, flags, desiredWidth, desiredHeight); + LoadFile(iconfile, type, desiredWidth, desiredHeight); } wxIcon::wxIcon(const wxIconLocation& loc) @@ -135,7 +135,7 @@ void wxIcon::CreateIconFromXpm(const char* const* data) } bool wxIcon::LoadFile(const wxString& filename, - long type, + wxBitmapType type, int desiredWidth, int desiredHeight) { UnRef(); diff --git a/src/os2/bitmap.cpp b/src/os2/bitmap.cpp index a565c74f17..73912fabc7 100644 --- a/src/os2/bitmap.cpp +++ b/src/os2/bitmap.cpp @@ -39,7 +39,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) // ============================================================================ // implementation @@ -1457,7 +1456,7 @@ bool wxMask::Create( bool wxBitmapHandler::Create( wxGDIImage* pImage, const void* pData, - long WXUNUSED(lFlags), + wxBitmapType WXUNUSED(lFlags), int nWidth, int nHeight, int nDepth) @@ -1477,7 +1476,7 @@ bool wxBitmapHandler::Create( wxGDIImage* pImage, bool wxBitmapHandler::Load( wxGDIImage* pImage , int nId -, long lFlags +, wxBitmapType lFlags , int nWidth , int nHeight ) @@ -1498,7 +1497,7 @@ bool wxBitmapHandler::Save( wxGDIImage* pImage , const wxString& rName , int lType -) +) const { wxBitmap* pBitmap = wxDynamicCast( pImage ,wxBitmap @@ -1513,7 +1512,7 @@ bool wxBitmapHandler::Save( bool wxBitmapHandler::Create( wxBitmap* WXUNUSED(pBitmap) , const void* WXUNUSED(pData) -, long WXUNUSED(lType) +, wxBitmapType WXUNUSED(lType) , int WXUNUSED(nWidth) , int WXUNUSED(nHeight) , int WXUNUSED(nDepth) @@ -1525,7 +1524,7 @@ bool wxBitmapHandler::Create( bool wxBitmapHandler::LoadFile( wxBitmap* WXUNUSED(pBitmap) , int WXUNUSED(nId) -, long WXUNUSED(lType) +, wxBitmapType WXUNUSED(lType) , int WXUNUSED(nDesiredWidth) , int WXUNUSED(nDesiredHeight) ) @@ -1536,7 +1535,7 @@ bool wxBitmapHandler::LoadFile( bool wxBitmapHandler::LoadFile( wxBitmap* WXUNUSED(pBitmap) , const wxString& WXUNUSED(rName) -, long WXUNUSED(lType) +, wxBitmapType WXUNUSED(lType) , int WXUNUSED(nDesiredWidth) , int WXUNUSED(nDesiredHeight) ) @@ -1547,9 +1546,9 @@ bool wxBitmapHandler::LoadFile( bool wxBitmapHandler::SaveFile( wxBitmap* WXUNUSED(pBitmap) , const wxString& WXUNUSED(rName) -, int WXUNUSED(nType) +, wxBitmapType WXUNUSED(nType) , const wxPalette* WXUNUSED(pPalette) -) +) const { return false; } diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp index 856f0288b8..7306e90644 100644 --- a/src/x11/bitmap.cpp +++ b/src/x11/bitmap.cpp @@ -1296,8 +1296,6 @@ int GrGetPixelColor(GR_SCREEN_INFO* sinfo, GR_PALETTE* palette, GR_PIXELVAL pixe // Bitmap handlers // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) - #define M_BMPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData()) #if wxUSE_XPM -- 2.47.2