]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dataobj2.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[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 // Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_GTK_DATAOBJ2_H_
11 #define _WX_GTK_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 Clear() { free(m_pngData); }
52 void ClearAll() { Clear(); Init(); }
53
54 size_t m_pngSize;
55 void *m_pngData;
56
57 void DoConvertToPng();
58
59 private:
60 void Init() { m_pngData = NULL; m_pngSize = 0; }
61 };
62
63 // ----------------------------------------------------------------------------
64 // wxFileDataObject is a specialization of wxDataObject for file names
65 // ----------------------------------------------------------------------------
66
67 class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
68 {
69 public:
70 // implement base class pure virtuals
71 // ----------------------------------
72
73 void AddFile( const wxString &filename );
74
75 virtual size_t GetDataSize() const;
76 virtual bool GetDataHere(void *buf) const;
77 virtual bool SetData(size_t len, const void *buf);
78 // Must provide overloads to avoid hiding them (and warnings about it)
79 virtual size_t GetDataSize(const wxDataFormat&) const
80 {
81 return GetDataSize();
82 }
83 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
84 {
85 return GetDataHere(buf);
86 }
87 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
88 {
89 return SetData(len, buf);
90 }
91 };
92
93 // ----------------------------------------------------------------------------
94 // wxURLDataObject is a specialization of wxDataObject for URLs
95 // ----------------------------------------------------------------------------
96
97 class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite
98 {
99 public:
100 wxURLDataObject(const wxString& url = wxEmptyString);
101
102 wxString GetURL() const;
103 void SetURL(const wxString& url);
104
105 private:
106 class wxTextURIListDataObject* const m_dobjURIList;
107 wxTextDataObject* const m_dobjText;
108
109 wxDECLARE_NO_COPY_CLASS(wxURLDataObject);
110 };
111
112
113 #endif // _WX_GTK_DATAOBJ2_H_
114