1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/dataobj2.h
3 // Purpose: declaration of standard wxDataObjectSimple-derived classes
4 // Author: Robert Roebling
5 // Created: 19.10.99 (extracted from gtk/dataobj.h)
7 // Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GTK_DATAOBJ2_H_
12 #define _WX_GTK_DATAOBJ2_H_
14 // ----------------------------------------------------------------------------
15 // wxBitmapDataObject is a specialization of wxDataObject for bitmaps
16 // ----------------------------------------------------------------------------
18 class WXDLLIMPEXP_CORE wxBitmapDataObject
: public wxBitmapDataObjectBase
23 wxBitmapDataObject(const wxBitmap
& bitmap
);
26 virtual ~wxBitmapDataObject();
28 // override base class virtual to update PNG data too
29 virtual void SetBitmap(const wxBitmap
& bitmap
);
31 // implement base class pure virtuals
32 // ----------------------------------
34 virtual size_t GetDataSize() const { return m_pngSize
; }
35 virtual bool GetDataHere(void *buf
) const;
36 virtual bool SetData(size_t len
, const void *buf
);
37 // Must provide overloads to avoid hiding them (and warnings about it)
38 virtual size_t GetDataSize(const wxDataFormat
&) const
42 virtual bool GetDataHere(const wxDataFormat
&, void *buf
) const
44 return GetDataHere(buf
);
46 virtual bool SetData(const wxDataFormat
&, size_t len
, const void *buf
)
48 return SetData(len
, buf
);
52 void Init() { m_pngData
= NULL
; m_pngSize
= 0; }
53 void Clear() { free(m_pngData
); }
54 void ClearAll() { Clear(); Init(); }
59 void DoConvertToPng();
62 // ----------------------------------------------------------------------------
63 // wxFileDataObject is a specialization of wxDataObject for file names
64 // ----------------------------------------------------------------------------
66 class WXDLLIMPEXP_CORE wxFileDataObject
: public wxFileDataObjectBase
69 // implement base class pure virtuals
70 // ----------------------------------
72 void AddFile( const wxString
&filename
);
74 virtual size_t GetDataSize() const;
75 virtual bool GetDataHere(void *buf
) const;
76 virtual bool SetData(size_t len
, const void *buf
);
77 // Must provide overloads to avoid hiding them (and warnings about it)
78 virtual size_t GetDataSize(const wxDataFormat
&) const
82 virtual bool GetDataHere(const wxDataFormat
&, void *buf
) const
84 return GetDataHere(buf
);
86 virtual bool SetData(const wxDataFormat
&, size_t len
, const void *buf
)
88 return SetData(len
, buf
);
92 // ----------------------------------------------------------------------------
93 // wxURLDataObject is a specialization of wxDataObject for URLs
94 // ----------------------------------------------------------------------------
96 class WXDLLIMPEXP_CORE wxURLDataObject
: public wxDataObjectSimple
99 wxURLDataObject(const wxString
& url
= wxEmptyString
);
101 wxString
GetURL() const { return m_url
; }
102 void SetURL(const wxString
& url
) { m_url
= url
; }
104 virtual size_t GetDataSize() const;
105 virtual bool GetDataHere(void *buf
) const;
106 virtual bool SetData(size_t len
, const void *buf
);
108 // Must provide overloads to avoid hiding them (and warnings about it)
109 virtual size_t GetDataSize(const wxDataFormat
&) const
111 return GetDataSize();
113 virtual bool GetDataHere(const wxDataFormat
&, void *buf
) const
115 return GetDataHere(buf
);
117 virtual bool SetData(const wxDataFormat
&, size_t len
, const void *buf
)
119 return SetData(len
, buf
);
127 #endif // _WX_GTK_DATAOBJ2_H_