]>
Commit | Line | Data |
---|---|---|
977ea6b6 DE |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cocoa/dataobj2.h | |
3 | // Purpose: declaration of standard wxDataObjectSimple-derived classes | |
4 | // Author: David Elliott <dfe@cox.net> | |
5 | // Modified by: | |
6 | // Created: 2003/07/23 | |
977ea6b6 | 7 | // Copyright: (c) 2003 David Elliott |
65571936 | 8 | // Licence: wxWindows licence |
977ea6b6 DE |
9 | /////////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef __WX_COCOA_DATAOBJ2_H__ | |
12 | #define __WX_COCOA_DATAOBJ2_H__ | |
13 | ||
14 | //========================================================================= | |
15 | // wxBitmapDataObject is a specialization of wxDataObject for bitmaps | |
16 | //========================================================================= | |
8da116cf | 17 | class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase |
977ea6b6 DE |
18 | { |
19 | public: | |
20 | // ctors | |
21 | wxBitmapDataObject(); | |
22 | wxBitmapDataObject(const wxBitmap& bitmap); | |
23 | ||
24 | // destr | |
d3c7fc99 | 25 | virtual ~wxBitmapDataObject(); |
977ea6b6 DE |
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: | |
d3b9f782 | 38 | void Init() { m_pngData = NULL; m_pngSize = 0; } |
977ea6b6 DE |
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 | ||
8da116cf | 61 | class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase |
977ea6b6 DE |
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_COCOA_DATAOBJ2_H__ |