]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/dataobj.h
Added some tentative wxMotif clipboard code; did some file formatting
[wxWidgets.git] / include / wx / gtk1 / dataobj.h
CommitLineData
8b53e5a2
RR
1///////////////////////////////////////////////////////////////////////////////
2// Name: dataobj.h
3// Purpose: declaration of the wxDataObject class
4// Author: Robert Roebling
5// RCS-ID: $Id$
6// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
7// Licence: wxWindows license
8///////////////////////////////////////////////////////////////////////////////
9
10#ifndef __GTKDATAOBJECTH__
11#define __GTKDATAOBJECTH__
12
13#ifdef __GNUG__
14#pragma interface
15#endif
16
17#include "wx/defs.h"
18#include "wx/object.h"
19#include "wx/string.h"
20#include "wx/bitmap.h"
21
22//-------------------------------------------------------------------------
23// classes
24//-------------------------------------------------------------------------
25
26class wxDataObject;
27class wxTextDataObject;
28class wxBitmapDataObject;
29class wxPrivateDataObject;
30class wxFileDataObject;
31
32//-------------------------------------------------------------------------
33// wxDataObject
34//-------------------------------------------------------------------------
35
36class wxDataObject: public wxObject
37{
38 DECLARE_ABSTRACT_CLASS( wxDataObject )
39
40public:
41
42 wxDataObject() {}
43 ~wxDataObject() {}
44
45 virtual wxDataFormat GetFormat() const = 0;
46
47 // implementation
48
49 GdkAtom m_formatAtom;
50};
51
52// ----------------------------------------------------------------------------
53// wxTextDataObject is a specialization of wxDataObject for text data
54// ----------------------------------------------------------------------------
55
56class wxTextDataObject : public wxDataObject
57{
58 DECLARE_DYNAMIC_CLASS( wxTextDataObject )
59
60public:
61
62 wxTextDataObject() {}
63 wxTextDataObject( const wxString& strText )
64 : m_strText(strText) { }
65
66 virtual wxDataFormat GetFormat() const
67 { return wxDF_TEXT; }
68
69 void SetText( const wxString& strText)
70 { m_strText = strText; }
71
06e43511 72 wxString GetText() const
8b53e5a2
RR
73 { return m_strText; }
74
75private:
76 wxString m_strText;
77
78};
79
80// ----------------------------------------------------------------------------
81// wxFileDataObject is a specialization of wxDataObject for file names
82// ----------------------------------------------------------------------------
83
84class wxFileDataObject : public wxDataObject
85{
86 DECLARE_DYNAMIC_CLASS( wxFileDataObject )
87
88public:
89
90 wxFileDataObject(void) {}
91
92 virtual wxDataFormat GetFormat() const
93 { return wxDF_FILENAME; }
94
95 void AddFile( const wxString &file )
96 { m_files += file; m_files += (char)0; }
97
06e43511 98 wxString GetFiles() const
8b53e5a2
RR
99 { return m_files; }
100
101private:
102 wxString m_files;
103
104};
105
106// ----------------------------------------------------------------------------
107// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
108// ----------------------------------------------------------------------------
109
110class wxBitmapDataObject : public wxDataObject
111{
112 DECLARE_DYNAMIC_CLASS( wxBitmapDataObject )
113
114public:
115
116 wxBitmapDataObject(void) {}
117
118 virtual wxDataFormat GetFormat() const
119 { return wxDF_BITMAP; }
120
121 void SetBitmap( const wxBitmap &bitmap )
122 { m_bitmap = bitmap; }
123
06e43511 124 wxBitmap GetBitmap() const
8b53e5a2
RR
125 { return m_bitmap; }
126
127private:
128 wxBitmap m_bitmap;
129};
130
131// ----------------------------------------------------------------------------
132// wxPrivateDataObject is a specialization of wxDataObject for app specific data
133// ----------------------------------------------------------------------------
134
135class wxPrivateDataObject : public wxDataObject
136{
137 DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
138
139public:
140
ab8884ac 141 wxPrivateDataObject();
8b53e5a2 142
ab8884ac 143 ~wxPrivateDataObject();
8b53e5a2
RR
144
145 virtual wxDataFormat GetFormat() const
146 { return wxDF_PRIVATE; }
147
148 // the string ID identifies the format of clipboard or DnD data. a word
149 // processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
150 // to the clipboard - the latter with the Id "WXWORD_FORMAT".
151
152 void SetId( const wxString& id )
153 { m_id = id; }
154
06e43511 155 wxString GetId() const
8b53e5a2
RR
156 { return m_id; }
157
158 // will make internal copy
159 void SetData( const char *data, size_t size );
160
06e43511 161 size_t GetDataSize() const
8b53e5a2
RR
162 { return m_size; }
163
06e43511 164 char* GetData() const
8b53e5a2
RR
165 { return m_data; }
166
167private:
168 size_t m_size;
169 char* m_data;
170 wxString m_id;
171};
172
173
174#endif
175 //__GTKDNDH__
176