dataobj2.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk1/dataobj2.h
  3. // Purpose: declaration of standard wxDataObjectSimple-derived classes
  4. // Author: Robert Roebling
  5. // Created: 19.10.99 (extracted from gtk/dataobj.h)
  6. // Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_GTK_DATAOBJ2_H_
  10. #define _WX_GTK_DATAOBJ2_H_
  11. // ----------------------------------------------------------------------------
  12. // wxBitmapDataObject is a specialization of wxDataObject for bitmaps
  13. // ----------------------------------------------------------------------------
  14. class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
  15. {
  16. public:
  17. // ctors
  18. wxBitmapDataObject();
  19. wxBitmapDataObject(const wxBitmap& bitmap);
  20. // destr
  21. virtual ~wxBitmapDataObject();
  22. // override base class virtual to update PNG data too
  23. virtual void SetBitmap(const wxBitmap& bitmap);
  24. // implement base class pure virtuals
  25. // ----------------------------------
  26. virtual size_t GetDataSize() const { return m_pngSize; }
  27. virtual bool GetDataHere(void *buf) const;
  28. virtual bool SetData(size_t len, const void *buf);
  29. protected:
  30. void Init() { m_pngData = NULL; m_pngSize = 0; }
  31. void Clear() { free(m_pngData); }
  32. void ClearAll() { Clear(); Init(); }
  33. size_t m_pngSize;
  34. void *m_pngData;
  35. void DoConvertToPng();
  36. private:
  37. // virtual function hiding supression
  38. size_t GetDataSize(const wxDataFormat& format) const
  39. { return(wxDataObjectSimple::GetDataSize(format)); }
  40. bool GetDataHere(const wxDataFormat& format, void* pBuf) const
  41. { return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
  42. bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
  43. { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
  44. };
  45. // ----------------------------------------------------------------------------
  46. // wxFileDataObject is a specialization of wxDataObject for file names
  47. // ----------------------------------------------------------------------------
  48. class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
  49. {
  50. public:
  51. // implement base class pure virtuals
  52. // ----------------------------------
  53. void AddFile( const wxString &filename );
  54. virtual size_t GetDataSize() const;
  55. virtual bool GetDataHere(void *buf) const;
  56. virtual bool SetData(size_t len, const void *buf);
  57. private:
  58. // virtual function hiding supression
  59. size_t GetDataSize(const wxDataFormat& format) const
  60. { return(wxDataObjectSimple::GetDataSize(format)); }
  61. bool GetDataHere(const wxDataFormat& format, void* pBuf) const
  62. { return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
  63. bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
  64. { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
  65. };
  66. #endif // _WX_GTK_DATAOBJ2_H_