]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dataobj2.h
Tried to make wxListBox::Update() work
[wxWidgets.git] / include / wx / gtk / dataobj2.h
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)
6 // RCS-ID: $Id$
7 // Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GTK_DATAOBJ2_H_
12 #define _WX_GTK_DATAOBJ2_H_
13
14 // ----------------------------------------------------------------------------
15 // wxBitmapDataObject is a specialization of wxDataObject for bitmaps
16 // ----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
19 {
20 public:
21 // ctors
22 wxBitmapDataObject();
23 wxBitmapDataObject(const wxBitmap& bitmap);
24
25 // destr
26 virtual ~wxBitmapDataObject();
27
28 // override base class virtual to update PNG data too
29 virtual void SetBitmap(const wxBitmap& bitmap);
30
31 // implement base class pure virtuals
32 // ----------------------------------
33
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
39 {
40 return GetDataSize();
41 }
42 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
43 {
44 return GetDataHere(buf);
45 }
46 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
47 {
48 return SetData(len, buf);
49 }
50
51 protected:
52 void Init() { m_pngData = (void *)NULL; m_pngSize = 0; }
53 void Clear() { free(m_pngData); }
54 void ClearAll() { Clear(); Init(); }
55
56 size_t m_pngSize;
57 void *m_pngData;
58
59 void DoConvertToPng();
60 };
61
62 // ----------------------------------------------------------------------------
63 // wxFileDataObject is a specialization of wxDataObject for file names
64 // ----------------------------------------------------------------------------
65
66 class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
67 {
68 public:
69 // implement base class pure virtuals
70 // ----------------------------------
71
72 void AddFile( const wxString &filename );
73
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
79 {
80 return GetDataSize();
81 }
82 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
83 {
84 return GetDataHere(buf);
85 }
86 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
87 {
88 return SetData(len, buf);
89 }
90 };
91
92 // ----------------------------------------------------------------------------
93 // wxURLDataObject is a specialization of wxDataObject for URLs
94 // ----------------------------------------------------------------------------
95
96 class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectSimple
97 {
98 public:
99 wxURLDataObject(const wxString& url = wxEmptyString);
100
101 wxString GetURL() const { return m_url; }
102 void SetURL(const wxString& url) { m_url = url; }
103
104 virtual size_t GetDataSize() const;
105 virtual bool GetDataHere(void *buf) const;
106 virtual bool SetData(size_t len, const void *buf);
107
108 // Must provide overloads to avoid hiding them (and warnings about it)
109 virtual size_t GetDataSize(const wxDataFormat&) const
110 {
111 return GetDataSize();
112 }
113 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
114 {
115 return GetDataHere(buf);
116 }
117 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
118 {
119 return SetData(len, buf);
120 }
121
122 private:
123 wxString m_url;
124 };
125
126
127 #endif // _WX_GTK_DATAOBJ2_H_
128