]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/dataobj2.h
Prevent seg fault for older GTK+
[wxWidgets.git] / include / wx / gtk1 / dataobj2.h
CommitLineData
3f364be8 1///////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/dataobj2.h
3f364be8
VZ
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);
37
38protected:
39 void Init() { m_pngData = (void *)NULL; m_pngSize = 0; }
40 void Clear() { free(m_pngData); }
41 void ClearAll() { Clear(); Init(); }
42
3f364be8
VZ
43 size_t m_pngSize;
44 void *m_pngData;
45
46 void DoConvertToPng();
b02da6b1
VZ
47
48private:
49 // virtual function hiding supression
50 size_t GetDataSize(const wxDataFormat& format) const
51 { return(wxDataObjectSimple::GetDataSize(format)); }
52 bool GetDataHere(const wxDataFormat& format, void* pBuf) const
53 { return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
54 bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
55 { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
3f364be8
VZ
56};
57
58// ----------------------------------------------------------------------------
59// wxFileDataObject is a specialization of wxDataObject for file names
60// ----------------------------------------------------------------------------
61
20123d49 62class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
3f364be8
VZ
63{
64public:
65 // implement base class pure virtuals
66 // ----------------------------------
67
b068c4e8
RR
68 void AddFile( const wxString &filename );
69
3f364be8
VZ
70 virtual size_t GetDataSize() const;
71 virtual bool GetDataHere(void *buf) const;
72 virtual bool SetData(size_t len, const void *buf);
b02da6b1
VZ
73
74private:
75 // virtual function hiding supression
76 size_t GetDataSize(const wxDataFormat& format) const
77 { return(wxDataObjectSimple::GetDataSize(format)); }
78 bool GetDataHere(const wxDataFormat& format, void* pBuf) const
79 { return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
80 bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
81 { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
3f364be8
VZ
82};
83
84#endif // _WX_GTK_DATAOBJ2_H_
85