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