dataobj2.h 3.0 KB

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