]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/dataobj2.h
The rounded corners look really dumb at this size.
[wxWidgets.git] / include / wx / x11 / dataobj2.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/dataobj2.h
3 // Purpose: declaration of standard wxDataObjectSimple-derived classes
4 // Author: Robert Roebling
5 // Created: 19.10.99 (extracted from gtk/dataobj.h)
6 // Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_X11_DATAOBJ2_H_
11 #define _WX_X11_DATAOBJ2_H_
12
13 // ----------------------------------------------------------------------------
14 // wxBitmapDataObject is a specialization of wxDataObject for bitmaps
15 // ----------------------------------------------------------------------------
16
17 class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
18 {
19 public:
20 // ctors
21 wxBitmapDataObject();
22 wxBitmapDataObject(const wxBitmap& bitmap);
23
24 // destr
25 virtual ~wxBitmapDataObject();
26
27 // override base class virtual to update PNG data too
28 virtual void SetBitmap(const wxBitmap& bitmap);
29
30 // implement base class pure virtuals
31 // ----------------------------------
32
33 virtual size_t GetDataSize() const { return m_pngSize; }
34 virtual bool GetDataHere(void *buf) const;
35 virtual bool SetData(size_t len, const void *buf);
36 // Must provide overloads to avoid hiding them (and warnings about it)
37 virtual size_t GetDataSize(const wxDataFormat&) const
38 {
39 return GetDataSize();
40 }
41 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
42 {
43 return GetDataHere(buf);
44 }
45 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
46 {
47 return SetData(len, buf);
48 }
49
50 protected:
51 void Init() { m_pngData = NULL; m_pngSize = 0; }
52 void Clear() { free(m_pngData); }
53 void ClearAll() { Clear(); Init(); }
54
55 size_t m_pngSize;
56 void *m_pngData;
57
58 void DoConvertToPng();
59 };
60
61 // ----------------------------------------------------------------------------
62 // wxFileDataObject is a specialization of wxDataObject for file names
63 // ----------------------------------------------------------------------------
64
65 class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
66 {
67 public:
68 // implement base class pure virtuals
69 // ----------------------------------
70
71 void AddFile( const wxString &filename );
72
73 virtual size_t GetDataSize() const;
74 virtual bool GetDataHere(void *buf) const;
75 virtual bool SetData(size_t len, const void *buf);
76 // Must provide overloads to avoid hiding them (and warnings about it)
77 virtual size_t GetDataSize(const wxDataFormat&) const
78 {
79 return GetDataSize();
80 }
81 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
82 {
83 return GetDataHere(buf);
84 }
85 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
86 {
87 return SetData(len, buf);
88 }
89 };
90
91 #endif // _WX_X11_DATAOBJ2_H_
92