]>
Commit | Line | Data |
---|---|---|
3922ecc9 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/ole/dataobj2.h | |
3 | // Purpose: second part of platform specific wxDataObject header - | |
4 | // declarations of predefined wxDataObjectSimple-derived classes | |
5 | // Author: Vadim Zeitlin | |
6 | // Modified by: | |
7 | // Created: 21.10.99 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
65571936 | 10 | // Licence: wxWindows licence |
3922ecc9 VZ |
11 | /////////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef _WX_MSW_OLE_DATAOBJ2_H | |
14 | #define _WX_MSW_OLE_DATAOBJ2_H | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // wxBitmapDataObject is a specialization of wxDataObject for bitmap data | |
18 | // | |
19 | // NB: in fact, under MSW we support CF_DIB (and not CF_BITMAP) clipboard | |
20 | // format and we also provide wxBitmapDataObject2 for CF_BITMAP (which is | |
21 | // rarely used). This is ugly, but I haven't found a solution for it yet. | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
53a2db12 | 24 | class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase |
3922ecc9 VZ |
25 | { |
26 | public: | |
27 | // ctors | |
28 | wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap) | |
29 | : wxBitmapDataObjectBase(bitmap) | |
30 | { | |
31 | SetFormat(wxDF_DIB); | |
32 | ||
33 | m_data = NULL; | |
34 | } | |
35 | ||
36 | // implement base class pure virtuals | |
37 | virtual size_t GetDataSize() const; | |
38 | virtual bool GetDataHere(void *buf) const; | |
39 | virtual bool SetData(size_t len, const void *buf); | |
40 | ||
0e4acbd4 JS |
41 | virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const |
42 | { return GetDataSize(); } | |
43 | virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), | |
44 | void *buf) const | |
45 | { return GetDataHere(buf); } | |
46 | virtual bool SetData(const wxDataFormat& WXUNUSED(format), | |
47 | size_t len, const void *buf) | |
48 | { return SetData(len, buf); } | |
49 | ||
3922ecc9 VZ |
50 | private: |
51 | // the DIB data | |
52 | void /* BITMAPINFO */ *m_data; | |
22f3361e | 53 | |
c0c133e1 | 54 | wxDECLARE_NO_COPY_CLASS(wxBitmapDataObject); |
3922ecc9 VZ |
55 | }; |
56 | ||
57 | // ---------------------------------------------------------------------------- | |
58 | // wxBitmapDataObject2 - a data object for CF_BITMAP | |
59 | // | |
60 | // FIXME did I already mention it was ugly? | |
61 | // ---------------------------------------------------------------------------- | |
62 | ||
53a2db12 | 63 | class WXDLLIMPEXP_CORE wxBitmapDataObject2 : public wxBitmapDataObjectBase |
3922ecc9 VZ |
64 | { |
65 | public: | |
66 | // ctors | |
67 | wxBitmapDataObject2(const wxBitmap& bitmap = wxNullBitmap) | |
68 | : wxBitmapDataObjectBase(bitmap) | |
69 | { | |
70 | } | |
71 | ||
72 | // implement base class pure virtuals | |
73 | virtual size_t GetDataSize() const; | |
74 | virtual bool GetDataHere(void *buf) const; | |
75 | virtual bool SetData(size_t len, const void *buf); | |
fc7a2a60 | 76 | |
0e4acbd4 JS |
77 | virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const |
78 | { return GetDataSize(); } | |
79 | virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), | |
80 | void *buf) const | |
81 | { return GetDataHere(buf); } | |
82 | virtual bool SetData(const wxDataFormat& WXUNUSED(format), | |
83 | size_t len, const void *buf) | |
84 | { return SetData(len, buf); } | |
85 | ||
fc7a2a60 | 86 | private: |
c0c133e1 | 87 | wxDECLARE_NO_COPY_CLASS(wxBitmapDataObject2); |
3922ecc9 VZ |
88 | }; |
89 | ||
90 | // ---------------------------------------------------------------------------- | |
91 | // wxFileDataObject - data object for CF_HDROP | |
92 | // ---------------------------------------------------------------------------- | |
93 | ||
53a2db12 | 94 | class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase |
3922ecc9 VZ |
95 | { |
96 | public: | |
fc7a2a60 VZ |
97 | wxFileDataObject() { } |
98 | ||
3922ecc9 VZ |
99 | // implement base class pure virtuals |
100 | virtual bool SetData(size_t len, const void *buf); | |
8b85d24e VZ |
101 | virtual size_t GetDataSize() const; |
102 | virtual bool GetDataHere(void *pData) const; | |
103 | virtual void AddFile(const wxString& file); | |
fc7a2a60 | 104 | |
0e4acbd4 JS |
105 | virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const |
106 | { return GetDataSize(); } | |
107 | virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), | |
108 | void *buf) const | |
109 | { return GetDataHere(buf); } | |
110 | virtual bool SetData(const wxDataFormat& WXUNUSED(format), | |
111 | size_t len, const void *buf) | |
112 | { return SetData(len, buf); } | |
113 | ||
fc7a2a60 | 114 | private: |
c0c133e1 | 115 | wxDECLARE_NO_COPY_CLASS(wxFileDataObject); |
3922ecc9 VZ |
116 | }; |
117 | ||
444ad3a7 VZ |
118 | // ---------------------------------------------------------------------------- |
119 | // wxURLDataObject: data object for URLs | |
120 | // ---------------------------------------------------------------------------- | |
121 | ||
53a2db12 | 122 | class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite |
444ad3a7 VZ |
123 | { |
124 | public: | |
0463eea9 VZ |
125 | // initialize with URL in ctor or use SetURL later |
126 | wxURLDataObject(const wxString& url = wxEmptyString); | |
444ad3a7 VZ |
127 | |
128 | // return the URL as string | |
129 | wxString GetURL() const; | |
130 | ||
e6d318c2 RD |
131 | // Set a string as the URL in the data object |
132 | void SetURL(const wxString& url); | |
133 | ||
444ad3a7 VZ |
134 | // override to set m_textFormat |
135 | virtual bool SetData(const wxDataFormat& format, | |
136 | size_t len, | |
137 | const void *buf); | |
138 | ||
139 | private: | |
140 | // last data object we got data in | |
141 | wxDataObjectSimple *m_dataObjectLast; | |
22f3361e | 142 | |
c0c133e1 | 143 | wxDECLARE_NO_COPY_CLASS(wxURLDataObject); |
444ad3a7 VZ |
144 | }; |
145 | ||
3922ecc9 | 146 | #endif // _WX_MSW_OLE_DATAOBJ2_H |