]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dataobj2.h
virtual method hiding in GTK, so add direct implementation
[wxWidgets.git] / include / wx / gtk / dataobj2.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/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 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 private:
61 void Init() { m_pngData = NULL; m_pngSize = 0; }
62 };
63
64 // ----------------------------------------------------------------------------
65 // wxFileDataObject is a specialization of wxDataObject for file names
66 // ----------------------------------------------------------------------------
67
68 class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
69 {
70 public:
71 // implement base class pure virtuals
72 // ----------------------------------
73
74 void AddFile( const wxString &filename );
75
76 virtual size_t GetDataSize() const;
77 virtual bool GetDataHere(void *buf) const;
78 virtual bool SetData(size_t len, const void *buf);
79 // Must provide overloads to avoid hiding them (and warnings about it)
80 virtual size_t GetDataSize(const wxDataFormat&) const
81 {
82 return GetDataSize();
83 }
84 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
85 {
86 return GetDataHere(buf);
87 }
88 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
89 {
90 return SetData(len, buf);
91 }
92 };
93
94 // ----------------------------------------------------------------------------
95 // wxURLDataObject is a specialization of wxDataObject for URLs
96 // ----------------------------------------------------------------------------
97
98 class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite
99 {
100 public:
101 wxURLDataObject(const wxString& url = wxEmptyString);
102
103 wxString GetURL() const;
104 void SetURL(const wxString& url);
105
106 private:
107 class wxTextURIListDataObject* const m_dobjURIList;
108 wxTextDataObject* const m_dobjText;
109
110 wxDECLARE_NO_COPY_CLASS(wxURLDataObject);
111 };
112
113
114 #endif // _WX_GTK_DATAOBJ2_H_
115