]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dataobj2.h
use DECLARE_NO_ASSIGN_CLASS() for better readability
[wxWidgets.git] / include / wx / gtk / dataobj2.h
CommitLineData
3f364be8
VZ
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
65571936 8// Licence: wxWindows licence
3f364be8
VZ
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_GTK_DATAOBJ2_H_
12#define _WX_GTK_DATAOBJ2_H_
13
3f364be8
VZ
14// ----------------------------------------------------------------------------
15// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
16// ----------------------------------------------------------------------------
17
20123d49 18class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
3f364be8
VZ
19{
20public:
21 // ctors
22 wxBitmapDataObject();
23 wxBitmapDataObject(const wxBitmap& bitmap);
24
25 // destr
d3c7fc99 26 virtual ~wxBitmapDataObject();
3f364be8
VZ
27
28 // override base class virtual to update PNG data too
29 virtual void SetBitmap(const wxBitmap& bitmap);
30
3f364be8
VZ
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);
6f02a879
VZ
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 }
3f364be8
VZ
50
51protected:
52 void Init() { m_pngData = (void *)NULL; m_pngSize = 0; }
53 void Clear() { free(m_pngData); }
54 void ClearAll() { Clear(); Init(); }
55
3f364be8
VZ
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
20123d49 66class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
3f364be8
VZ
67{
68public:
69 // implement base class pure virtuals
70 // ----------------------------------
71
b068c4e8
RR
72 void AddFile( const wxString &filename );
73
3f364be8
VZ
74 virtual size_t GetDataSize() const;
75 virtual bool GetDataHere(void *buf) const;
76 virtual bool SetData(size_t len, const void *buf);
6f02a879
VZ
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 }
3f364be8
VZ
90};
91
d613be55
RR
92// ----------------------------------------------------------------------------
93// wxURLDataObject is a specialization of wxDataObject for URLs
94// ----------------------------------------------------------------------------
95
96class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectSimple
97{
98public:
99 wxURLDataObject(const wxString& url = wxEmptyString);
100
101 wxString GetURL() const { return m_url; }
102 void SetURL(const wxString& url) { m_url = url; }
d613be55
RR
103
104 virtual size_t GetDataSize() const;
105 virtual bool GetDataHere(void *buf) const;
106 virtual bool SetData(size_t len, const void *buf);
fcda20eb
VZ
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
122private:
123 wxString m_url;
d613be55
RR
124};
125
126
3f364be8
VZ
127#endif // _WX_GTK_DATAOBJ2_H_
128