]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/dataobj2.h
Applied #15226 with modifications: wxRichTextCtrl: Implement setting properties with...
[wxWidgets.git] / include / wx / x11 / dataobj2.h
CommitLineData
9691c806 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/x11/dataobj2.h
9691c806
RR
3// Purpose: declaration of standard wxDataObjectSimple-derived classes
4// Author: Robert Roebling
5// Created: 19.10.99 (extracted from gtk/dataobj.h)
9691c806 6// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
65571936 7// Licence: wxWindows licence
9691c806
RR
8///////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_X11_DATAOBJ2_H_
11#define _WX_X11_DATAOBJ2_H_
12
9691c806
RR
13// ----------------------------------------------------------------------------
14// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
15// ----------------------------------------------------------------------------
16
968eb2ef 17class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
9691c806
RR
18{
19public:
20 // ctors
21 wxBitmapDataObject();
22 wxBitmapDataObject(const wxBitmap& bitmap);
23
24 // destr
d3c7fc99 25 virtual ~wxBitmapDataObject();
9691c806
RR
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);
6f02a879
VZ
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 }
9691c806
RR
49
50protected:
d3b9f782 51 void Init() { m_pngData = NULL; m_pngSize = 0; }
9691c806
RR
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();
9691c806
RR
59};
60
61// ----------------------------------------------------------------------------
62// wxFileDataObject is a specialization of wxDataObject for file names
63// ----------------------------------------------------------------------------
64
968eb2ef 65class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
9691c806
RR
66{
67public:
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);
6f02a879
VZ
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 }
9691c806
RR
89};
90
91#endif // _WX_X11_DATAOBJ2_H_
92