1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declaration of the wxDataObject class
4 // Author: Julian Smart
6 // Copyright: (c) 1998 Julian Smart
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_DATAOBJ_H_
11 #define _WX_DATAOBJ_H_
18 #include "wx/object.h"
19 #include "wx/string.h"
20 #include "wx/bitmap.h"
22 //-------------------------------------------------------------------------
24 //-------------------------------------------------------------------------
26 class WXDLLEXPORT wxDataObject
;
27 class WXDLLEXPORT wxTextDataObject
;
28 class WXDLLEXPORT wxBitmapDataObject
;
29 class WXDLLEXPORT wxPrivateDataObject
;
30 class WXDLLEXPORT wxFileDataObject
;
32 //-------------------------------------------------------------------------
34 //-------------------------------------------------------------------------
36 class WXDLLEXPORT wxDataObject
: public wxObject
38 DECLARE_ABSTRACT_CLASS( wxDataObject
)
45 virtual wxDataFormat
GetFormat() const = 0;
50 // ----------------------------------------------------------------------------
51 // wxTextDataObject is a specialization of wxDataObject for text data
52 // ----------------------------------------------------------------------------
54 class WXDLLEXPORT wxTextDataObject
: public wxDataObject
56 DECLARE_DYNAMIC_CLASS( wxTextDataObject
)
61 wxTextDataObject( const wxString
& strText
)
62 : m_strText(strText
) { }
64 virtual wxDataFormat
GetFormat() const
67 void SetText( const wxString
& strText
)
68 { m_strText
= strText
; }
70 wxString
GetText() const
78 // ----------------------------------------------------------------------------
79 // wxFileDataObject is a specialization of wxDataObject for file names
80 // ----------------------------------------------------------------------------
82 class WXDLLEXPORT wxFileDataObject
: public wxDataObject
84 DECLARE_DYNAMIC_CLASS( wxFileDataObject
)
88 wxFileDataObject(void) {}
90 virtual wxDataFormat
GetFormat() const
91 { return wxDF_FILENAME
; }
93 void AddFile( const wxString
&file
)
94 { m_files
+= file
; m_files
+= (char)0; }
96 wxString
GetFiles() const
104 // ----------------------------------------------------------------------------
105 // wxBitmapDataObject is a specialization of wxDataObject for bitmaps
106 // ----------------------------------------------------------------------------
108 class WXDLLEXPORT wxBitmapDataObject
: public wxDataObject
110 DECLARE_DYNAMIC_CLASS( wxBitmapDataObject
)
114 wxBitmapDataObject(void) {}
116 virtual wxDataFormat
GetFormat() const
117 { return wxDF_BITMAP
; }
119 void SetBitmap( const wxBitmap
&bitmap
)
120 { m_bitmap
= bitmap
; }
122 wxBitmap
GetBitmap() const
129 // ----------------------------------------------------------------------------
130 // wxPrivateDataObject is a specialization of wxDataObject for app specific data
131 // ----------------------------------------------------------------------------
133 class WXDLLEXPORT wxPrivateDataObject
: public wxDataObject
135 DECLARE_DYNAMIC_CLASS( wxPrivateDataObject
)
139 wxPrivateDataObject();
141 ~wxPrivateDataObject();
143 virtual wxDataFormat
GetFormat() const
144 { return wxDF_PRIVATE
; }
146 // the string ID identifies the format of clipboard or DnD data. a word
147 // processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
148 // to the clipboard - the latter with the Id "WXWORD_FORMAT".
150 void SetId( const wxString
& id
)
153 wxString
GetId() const
156 // will make internal copy
157 void SetData( const char *data
, size_t size
);
159 size_t GetDataSize() const
162 char* GetData() const