]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/dataobj2.h
applied tons of wxGrid patches
[wxWidgets.git] / include / wx / os2 / dataobj2.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: mac/dataobj2.h
3 // Purpose: declaration of standard wxDataObjectSimple-derived classes
4 // Author: Stefan Csomor (adapted from Robert Roebling's gtk port
5 // Modified by:
6 // Created: 10/21/99
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MAC_DATAOBJ2_H_
13 #define _WX_MAC_DATAOBJ2_H_
14
15 #ifdef __GNUG__
16 #pragma interface "dataobj.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // wxBitmapDataObject is a specialization of wxDataObject for bitmaps
21 // ----------------------------------------------------------------------------
22
23 class wxBitmapDataObject : public wxBitmapDataObjectBase
24 {
25 public:
26 // ctors
27 wxBitmapDataObject();
28 wxBitmapDataObject(const wxBitmap& bitmap);
29
30 // destr
31 ~wxBitmapDataObject();
32
33 // override base class virtual to update PNG data too
34 virtual void SetBitmap(const wxBitmap& bitmap);
35
36 // implement base class pure virtuals
37 // ----------------------------------
38
39 virtual size_t GetDataSize() const { return m_pngSize; }
40 virtual bool GetDataHere(void *buf) const;
41 virtual bool SetData(size_t len, const void *buf);
42
43 protected:
44 void Init() { m_pngData = (void *)NULL; m_pngSize = 0; }
45 void Clear() { free(m_pngData); }
46 void ClearAll() { Clear(); Init(); }
47
48 size_t m_pngSize;
49 void *m_pngData;
50
51 void DoConvertToPng();
52
53 private:
54 // Virtual function hiding supression
55 size_t GetDataSize(const wxDataFormat& rFormat) const
56 { return(wxDataObjectSimple::GetDataSize(rFormat)); }
57 bool GetDataHere(const wxDataFormat& rFormat, void* pBuf) const
58 { return(wxDataObjectSimple::GetDataHere(rFormat, pBuf)); }
59 bool SetData(const wxDataFormat& rFormat, size_t nLen, const void* pBuf)
60 { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); }
61 };
62
63 // ----------------------------------------------------------------------------
64 // wxFileDataObject is a specialization of wxDataObject for file names
65 // ----------------------------------------------------------------------------
66
67 class wxFileDataObject : public wxFileDataObjectBase
68 {
69 public:
70 // implement base class pure virtuals
71 // ----------------------------------
72
73 void AddFile( const wxString &filename );
74
75 virtual size_t GetDataSize() const;
76 virtual bool GetDataHere(void *buf) const;
77 virtual bool SetData(size_t len, const void *buf);
78
79 private:
80 // Virtual function hiding supression
81 size_t GetDataSize(const wxDataFormat& rFormat) const
82 { return(wxDataObjectSimple::GetDataSize(rFormat)); }
83 bool GetDataHere(const wxDataFormat& rFormat, void* pBuf) const
84 { return(wxDataObjectSimple::GetDataHere(rFormat, pBuf)); }
85 bool SetData(const wxDataFormat& rFormat, size_t nLen, const void* pBuf)
86 { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); }
87 };
88
89 #endif // _WX_MAC_DATAOBJ2_H_
90