dataobj2.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/dataobj2.h
  3. // Purpose: declaration of standard wxDataObjectSimple-derived classes
  4. // Author: David Webster (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_MAC_DATAOBJ2_H_
  11. #define _WX_MAC_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 ;
  28. virtual bool GetDataHere(void *buf) const ;
  29. virtual bool SetData(size_t len, const void *buf);
  30. // Must provide overloads to avoid hiding them (and warnings about it)
  31. virtual size_t GetDataSize(const wxDataFormat&) const
  32. {
  33. return GetDataSize();
  34. }
  35. virtual bool GetDataHere(const wxDataFormat&, void *buf) const
  36. {
  37. return GetDataHere(buf);
  38. }
  39. virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
  40. {
  41. return SetData(len, buf);
  42. }
  43. protected :
  44. void Init() ;
  45. void Clear() ;
  46. void* m_pictHandle ;
  47. bool m_pictCreated ;
  48. };
  49. // ----------------------------------------------------------------------------
  50. // wxFileDataObject is a specialization of wxDataObject for file names
  51. // ----------------------------------------------------------------------------
  52. class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
  53. {
  54. public:
  55. // implement base class pure virtuals
  56. // ----------------------------------
  57. void AddFile( const wxString &filename );
  58. virtual size_t GetDataSize() const;
  59. virtual bool GetDataHere(void *buf) const;
  60. virtual bool SetData(size_t len, const void *buf);
  61. // Must provide overloads to avoid hiding them (and warnings about it)
  62. virtual size_t GetDataSize(const wxDataFormat&) const
  63. {
  64. return GetDataSize();
  65. }
  66. virtual bool GetDataHere(const wxDataFormat&, void *buf) const
  67. {
  68. return GetDataHere(buf);
  69. }
  70. virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
  71. {
  72. return SetData(len, buf);
  73. }
  74. protected:
  75. // translates the filenames stored into a utf8 encoded char stream
  76. void GetFileNames(wxCharBuffer &buf) const ;
  77. };
  78. #endif // _WX_MAC_DATAOBJ2_H_