]>
Commit | Line | Data |
---|---|---|
6dddc146 | 1 | /////////////////////////////////////////////////////////////////////////////// |
0e2a14e5 | 2 | // Name: wx/os2/dataobj2.h |
6dddc146 | 3 | // Purpose: declaration of standard wxDataObjectSimple-derived classes |
7c74e7fe | 4 | // Author: Stefan Csomor (adapted from Robert Roebling's gtk port |
6dddc146 DW |
5 | // Modified by: |
6 | // Created: 10/21/99 | |
6dddc146 | 7 | // Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling |
65571936 | 8 | // Licence: wxWindows licence |
6dddc146 DW |
9 | /////////////////////////////////////////////////////////////////////////////// |
10 | ||
0e2a14e5 WS |
11 | #ifndef _WX_OS2_DATAOBJ2_H_ |
12 | #define _WX_OS2_DATAOBJ2_H_ | |
6dddc146 | 13 | |
6dddc146 DW |
14 | // ---------------------------------------------------------------------------- |
15 | // wxBitmapDataObject is a specialization of wxDataObject for bitmaps | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
0e2a14e5 | 18 | class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase |
6dddc146 DW |
19 | { |
20 | public: | |
21 | // ctors | |
22 | wxBitmapDataObject(); | |
23 | wxBitmapDataObject(const wxBitmap& bitmap); | |
24 | ||
25 | // destr | |
d3c7fc99 | 26 | virtual ~wxBitmapDataObject(); |
6dddc146 DW |
27 | |
28 | // override base class virtual to update PNG data too | |
29 | virtual void SetBitmap(const wxBitmap& bitmap); | |
30 | ||
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 | ||
38 | protected: | |
d3b9f782 | 39 | void Init() { m_pngData = NULL; m_pngSize = 0; } |
6dddc146 DW |
40 | void Clear() { free(m_pngData); } |
41 | void ClearAll() { Clear(); Init(); } | |
42 | ||
43 | size_t m_pngSize; | |
44 | void *m_pngData; | |
45 | ||
46 | void DoConvertToPng(); | |
47 | ||
48 | private: | |
49 | // Virtual function hiding supression | |
50 | size_t GetDataSize(const wxDataFormat& rFormat) const | |
51 | { return(wxDataObjectSimple::GetDataSize(rFormat)); } | |
52 | bool GetDataHere(const wxDataFormat& rFormat, void* pBuf) const | |
53 | { return(wxDataObjectSimple::GetDataHere(rFormat, pBuf)); } | |
54 | bool SetData(const wxDataFormat& rFormat, size_t nLen, const void* pBuf) | |
55 | { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); } | |
56 | }; | |
57 | ||
58 | // ---------------------------------------------------------------------------- | |
59 | // wxFileDataObject is a specialization of wxDataObject for file names | |
60 | // ---------------------------------------------------------------------------- | |
61 | ||
62 | class wxFileDataObject : public wxFileDataObjectBase | |
63 | { | |
64 | public: | |
65 | // implement base class pure virtuals | |
66 | // ---------------------------------- | |
67 | ||
68 | void AddFile( const wxString &filename ); | |
69 | ||
70 | virtual size_t GetDataSize() const; | |
71 | virtual bool GetDataHere(void *buf) const; | |
72 | virtual bool SetData(size_t len, const void *buf); | |
73 | ||
74 | private: | |
75 | // Virtual function hiding supression | |
76 | size_t GetDataSize(const wxDataFormat& rFormat) const | |
77 | { return(wxDataObjectSimple::GetDataSize(rFormat)); } | |
78 | bool GetDataHere(const wxDataFormat& rFormat, void* pBuf) const | |
79 | { return(wxDataObjectSimple::GetDataHere(rFormat, pBuf)); } | |
80 | bool SetData(const wxDataFormat& rFormat, size_t nLen, const void* pBuf) | |
81 | { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); } | |
82 | }; | |
83 | ||
0e2a14e5 | 84 | #endif // _WX_OS2_DATAOBJ2_H_ |