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