]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/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 licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_OS2_DATAOBJ2_H_ | |
13 | #define _WX_OS2_DATAOBJ2_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // wxBitmapDataObject is a specialization of wxDataObject for bitmaps | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase | |
20 | { | |
21 | public: | |
22 | // ctors | |
23 | wxBitmapDataObject(); | |
24 | wxBitmapDataObject(const wxBitmap& bitmap); | |
25 | ||
26 | // destr | |
27 | virtual ~wxBitmapDataObject(); | |
28 | ||
29 | // override base class virtual to update PNG data too | |
30 | virtual void SetBitmap(const wxBitmap& bitmap); | |
31 | ||
32 | // implement base class pure virtuals | |
33 | // ---------------------------------- | |
34 | ||
35 | virtual size_t GetDataSize() const { return m_pngSize; } | |
36 | virtual bool GetDataHere(void *buf) const; | |
37 | virtual bool SetData(size_t len, const void *buf); | |
38 | ||
39 | protected: | |
40 | void Init() { m_pngData = NULL; m_pngSize = 0; } | |
41 | void Clear() { free(m_pngData); } | |
42 | void ClearAll() { Clear(); Init(); } | |
43 | ||
44 | size_t m_pngSize; | |
45 | void *m_pngData; | |
46 | ||
47 | void DoConvertToPng(); | |
48 | ||
49 | private: | |
50 | // Virtual function hiding supression | |
51 | size_t GetDataSize(const wxDataFormat& rFormat) const | |
52 | { return(wxDataObjectSimple::GetDataSize(rFormat)); } | |
53 | bool GetDataHere(const wxDataFormat& rFormat, void* pBuf) const | |
54 | { return(wxDataObjectSimple::GetDataHere(rFormat, pBuf)); } | |
55 | bool SetData(const wxDataFormat& rFormat, size_t nLen, const void* pBuf) | |
56 | { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); } | |
57 | }; | |
58 | ||
59 | // ---------------------------------------------------------------------------- | |
60 | // wxFileDataObject is a specialization of wxDataObject for file names | |
61 | // ---------------------------------------------------------------------------- | |
62 | ||
63 | class wxFileDataObject : public wxFileDataObjectBase | |
64 | { | |
65 | public: | |
66 | // implement base class pure virtuals | |
67 | // ---------------------------------- | |
68 | ||
69 | void AddFile( const wxString &filename ); | |
70 | ||
71 | virtual size_t GetDataSize() const; | |
72 | virtual bool GetDataHere(void *buf) const; | |
73 | virtual bool SetData(size_t len, const void *buf); | |
74 | ||
75 | private: | |
76 | // Virtual function hiding supression | |
77 | size_t GetDataSize(const wxDataFormat& rFormat) const | |
78 | { return(wxDataObjectSimple::GetDataSize(rFormat)); } | |
79 | bool GetDataHere(const wxDataFormat& rFormat, void* pBuf) const | |
80 | { return(wxDataObjectSimple::GetDataHere(rFormat, pBuf)); } | |
81 | bool SetData(const wxDataFormat& rFormat, size_t nLen, const void* pBuf) | |
82 | { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); } | |
83 | }; | |
84 | ||
85 | #endif // _WX_OS2_DATAOBJ2_H_ |