]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dataobj.h
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declaration of the wxDataObject class
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
7 // Licence: wxWindows license
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKDATAOBJECTH__
11 #define __GTKDATAOBJECTH__
18 #include "wx/object.h"
19 #include "wx/string.h"
20 #include "wx/bitmap.h"
22 //-------------------------------------------------------------------------
24 //-------------------------------------------------------------------------
27 class wxTextDataObject
;
28 class wxBitmapDataObject
;
29 class wxPrivateDataObject
;
30 class wxFileDataObject
;
32 //-------------------------------------------------------------------------
34 //-------------------------------------------------------------------------
36 class wxDataObject
: public wxObject
38 DECLARE_ABSTRACT_CLASS( wxDataObject
)
45 virtual wxDataFormat
GetFormat() const = 0;
52 // ----------------------------------------------------------------------------
53 // wxTextDataObject is a specialization of wxDataObject for text data
54 // ----------------------------------------------------------------------------
56 class wxTextDataObject
: public wxDataObject
58 DECLARE_DYNAMIC_CLASS( wxTextDataObject
)
63 wxTextDataObject( const wxString
& strText
)
64 : m_strText(strText
) { }
66 virtual wxDataFormat
GetFormat() const
69 void SetText( const wxString
& strText
)
70 { m_strText
= strText
; }
72 wxString
GetText() const
80 // ----------------------------------------------------------------------------
81 // wxFileDataObject is a specialization of wxDataObject for file names
82 // ----------------------------------------------------------------------------
84 class wxFileDataObject
: public wxDataObject
86 DECLARE_DYNAMIC_CLASS( wxFileDataObject
)
90 wxFileDataObject(void) {}
92 virtual wxDataFormat
GetFormat() const
93 { return wxDF_FILENAME
; }
95 void AddFile( const wxString
&file
)
96 { m_files
+= file
; m_files
+= (char)0; }
98 wxString
GetFiles() const
106 // ----------------------------------------------------------------------------
107 // wxBitmapDataObject is a specialization of wxDataObject for bitmaps
108 // ----------------------------------------------------------------------------
110 class wxBitmapDataObject
: public wxDataObject
112 DECLARE_DYNAMIC_CLASS( wxBitmapDataObject
)
116 wxBitmapDataObject(void) {}
118 virtual wxDataFormat
GetFormat() const
119 { return wxDF_BITMAP
; }
121 void SetBitmap( const wxBitmap
&bitmap
)
122 { m_bitmap
= bitmap
; }
124 wxBitmap
GetBitmap() const
131 // ----------------------------------------------------------------------------
132 // wxPrivateDataObject is a specialization of wxDataObject for app specific data
133 // ----------------------------------------------------------------------------
135 class wxPrivateDataObject
: public wxDataObject
137 DECLARE_DYNAMIC_CLASS( wxPrivateDataObject
)
141 wxPrivateDataObject()
142 { m_size
= 0; m_data
= (char*) NULL
; }
144 ~wxPrivateDataObject()
145 { if (m_data
) delete[] m_data
; }
147 virtual wxDataFormat
GetFormat() const
148 { return wxDF_PRIVATE
; }
150 // the string ID identifies the format of clipboard or DnD data. a word
151 // processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
152 // to the clipboard - the latter with the Id "WXWORD_FORMAT".
154 void SetId( const wxString
& id
)
157 wxString
GetId() const
160 // will make internal copy
161 void SetData( const char *data
, size_t size
);
163 size_t GetDataSize() const
166 char* GetData() const