From: Robert Roebling Date: Sat, 5 Feb 2005 14:17:27 +0000 (+0000) Subject: Second try to add "support" for deriving from X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4b61c88d55f71d59affa4e57df52c99cdaaa5c08 Second try to add "support" for deriving from wxBitmapHandlerBase. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31767 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h index f5f6b51ceb..7ce0770d85 100644 --- a/include/wx/bitmap.h +++ b/include/wx/bitmap.h @@ -64,18 +64,19 @@ public: virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL) = 0; - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(wxBitmapType type) { m_type = type; } - wxString GetName() const { return m_name; } - wxString GetExtension() const { return m_extension; } - wxBitmapType GetType() const { return m_type; } - -protected: + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(wxBitmapType type) { m_type = type; } + wxString GetName() const { return m_name; } + wxString GetExtension() const { return m_extension; } + wxBitmapType GetType() const { return m_type; } + +private: wxString m_name; wxString m_extension; wxBitmapType m_type; +private: DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase) }; diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 6ad8ede7d6..c343811598 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -106,7 +106,7 @@ public: wxPalette *GetColourMap() const { return GetPalette(); }; #endif // wxUSE_PALETTE - static void InitStandardHandlers() { } + static void InitStandardHandlers(); // implementation // -------------- @@ -153,8 +153,30 @@ private: friend class wxMemoryDC; #endif - + friend class wxBitmapHandler; + +private: DECLARE_DYNAMIC_CLASS(wxBitmap) }; +//----------------------------------------------------------------------------- +// wxBitmapHandler +//----------------------------------------------------------------------------- + +class wxBitmapHandler: public wxBitmapHandlerBase +{ +public: + wxBitmapHandler() { } + virtual ~wxBitmapHandler(); + + virtual bool Create(wxBitmap *bitmap, 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); + +private: + DECLARE_DYNAMIC_CLASS(wxBitmapHandler) +}; + + #endif // __GTKBITMAPH__ diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 6ad8ede7d6..c343811598 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -106,7 +106,7 @@ public: wxPalette *GetColourMap() const { return GetPalette(); }; #endif // wxUSE_PALETTE - static void InitStandardHandlers() { } + static void InitStandardHandlers(); // implementation // -------------- @@ -153,8 +153,30 @@ private: friend class wxMemoryDC; #endif - + friend class wxBitmapHandler; + +private: DECLARE_DYNAMIC_CLASS(wxBitmap) }; +//----------------------------------------------------------------------------- +// wxBitmapHandler +//----------------------------------------------------------------------------- + +class wxBitmapHandler: public wxBitmapHandlerBase +{ +public: + wxBitmapHandler() { } + virtual ~wxBitmapHandler(); + + virtual bool Create(wxBitmap *bitmap, 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); + +private: + DECLARE_DYNAMIC_CLASS(wxBitmapHandler) +}; + + #endif // __GTKBITMAPH__ diff --git a/include/wx/mac/carbon/bitmap.h b/include/wx/mac/carbon/bitmap.h index a8e2439362..d3a9e8d953 100644 --- a/include/wx/mac/carbon/bitmap.h +++ b/include/wx/mac/carbon/bitmap.h @@ -103,27 +103,17 @@ public: class WXDLLEXPORT wxBitmapHandler: public wxBitmapHandlerBase { - DECLARE_DYNAMIC_CLASS(wxBitmapHandler) public: - wxBitmapHandler() : m_name(), m_extension(), m_type(0) { } - virtual ~wxBitmapHandler(); + wxBitmapHandler() { } + virtual ~wxBitmapHandler(); - virtual bool Create(wxBitmap *bitmap, 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 *bitmap, 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); - void SetName(const wxString& name) { m_name = name; } - void SetExtension(const wxString& ext) { m_extension = ext; } - void SetType(long type) { m_type = type; } - wxString GetName() const { return m_name; } - wxString GetExtension() const { return m_extension; } - long GetType() const { return m_type; } - -protected: - wxString m_name; - wxString m_extension; - long m_type; +private: + DECLARE_DYNAMIC_CLASS(wxBitmapHandler) }; #define M_BITMAPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData()) diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index adf047670c..90d40cefbf 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -1555,4 +1555,36 @@ void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep) } } +//----------------------------------------------------------------------------- +// wxBitmapHandler +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler,wxBitmapHandlerBase) + +wxBitmapHandler::~wxBitmapHandler() +{ +} + +bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) +{ + return FALSE; +} + +bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth, int desiredHeight) +{ + return FALSE; +} + +bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette) +{ + return FALSE; +} + +/* static */ void wxBitmap::InitStandardHandlers() +{ + // TODO: Insert handler based on GdkPixbufs handler later +} + + #endif // __WXGTK20__ diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index adf047670c..90d40cefbf 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -1555,4 +1555,36 @@ void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep) } } +//----------------------------------------------------------------------------- +// wxBitmapHandler +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler,wxBitmapHandlerBase) + +wxBitmapHandler::~wxBitmapHandler() +{ +} + +bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) +{ + return FALSE; +} + +bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth, int desiredHeight) +{ + return FALSE; +} + +bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette) +{ + return FALSE; +} + +/* static */ void wxBitmap::InitStandardHandlers() +{ + // TODO: Insert handler based on GdkPixbufs handler later +} + + #endif // __WXGTK20__