dataobj.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/ole/dataobj.h
  3. // Purpose: declaration of the wxDataObject class
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 10.05.98
  7. // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MSW_OLE_DATAOBJ_H
  11. #define _WX_MSW_OLE_DATAOBJ_H
  12. // ----------------------------------------------------------------------------
  13. // forward declarations
  14. // ----------------------------------------------------------------------------
  15. struct IDataObject;
  16. // ----------------------------------------------------------------------------
  17. // wxDataObject is a "smart" and polymorphic piece of data.
  18. // ----------------------------------------------------------------------------
  19. class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase
  20. {
  21. public:
  22. // ctor & dtor
  23. wxDataObject();
  24. virtual ~wxDataObject();
  25. // retrieve IDataObject interface (for other OLE related classes)
  26. IDataObject *GetInterface() const { return m_pIDataObject; }
  27. // tell the object that it should be now owned by IDataObject - i.e. when
  28. // it is deleted, it should delete us as well
  29. void SetAutoDelete();
  30. // return true if we support this format in "Get" direction
  31. bool IsSupportedFormat(const wxDataFormat& format) const
  32. { return wxDataObjectBase::IsSupported(format, Get); }
  33. // if this method returns false, this wxDataObject will be copied to
  34. // the clipboard with its size prepended to it, which is compatible with
  35. // older wx versions
  36. //
  37. // if returns true, then this wxDataObject will be copied to the clipboard
  38. // without any additional information and ::HeapSize() function will be used
  39. // to get the size of that data
  40. virtual bool NeedsVerbatimData(const wxDataFormat& WXUNUSED(format)) const
  41. {
  42. // return false from here only for compatibility with earlier wx versions
  43. return true;
  44. }
  45. // function to return symbolic name of clipboard format (for debug messages)
  46. #ifdef __WXDEBUG__
  47. static const wxChar *GetFormatName(wxDataFormat format);
  48. #define wxGetFormatName(format) wxDataObject::GetFormatName(format)
  49. #else // !Debug
  50. #define wxGetFormatName(format) wxT("")
  51. #endif // Debug/!Debug
  52. // they need to be accessed from wxIDataObject, so made them public,
  53. // or wxIDataObject friend
  54. public:
  55. virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size,
  56. const wxDataFormat& format );
  57. virtual void* SetSizeInBuffer( void* buffer, size_t size,
  58. const wxDataFormat& format );
  59. virtual size_t GetBufferOffset( const wxDataFormat& format );
  60. private:
  61. IDataObject *m_pIDataObject; // pointer to the COM interface
  62. wxDECLARE_NO_COPY_CLASS(wxDataObject);
  63. };
  64. #endif //_WX_MSW_OLE_DATAOBJ_H