]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/dataobj2.h
refactor wxGTK mnemonics conversion functions in a separate file to be able to reuse...
[wxWidgets.git] / include / wx / x11 / dataobj2.h
CommitLineData
9691c806
RR
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
9691c806
RR
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_X11_DATAOBJ2_H_
12#define _WX_X11_DATAOBJ2_H_
13
9691c806
RR
14// ----------------------------------------------------------------------------
15// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
16// ----------------------------------------------------------------------------
17
968eb2ef 18class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
9691c806
RR
19{
20public:
21 // ctors
22 wxBitmapDataObject();
23 wxBitmapDataObject(const wxBitmap& bitmap);
24
25 // destr
d3c7fc99 26 virtual ~wxBitmapDataObject();
9691c806
RR
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);
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 }
9691c806
RR
50
51protected:
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();
9691c806
RR
60};
61
62// ----------------------------------------------------------------------------
63// wxFileDataObject is a specialization of wxDataObject for file names
64// ----------------------------------------------------------------------------
65
968eb2ef 66class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
9691c806
RR
67{
68public:
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);
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 }
9691c806
RR
90};
91
92#endif // _WX_X11_DATAOBJ2_H_
93