]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dataobj.h
Use "_x64" instead of "amd64" for x64 MSW makefile builds.
[wxWidgets.git] / include / wx / dataobj.h
CommitLineData
3f480da3 1///////////////////////////////////////////////////////////////////////////////
e1ee679c 2// Name: wx/dataobj.h
3f480da3 3// Purpose: common data object classes
e1ee679c 4// Author: Vadim Zeitlin, Robert Roebling
3f480da3
VZ
5// Modified by:
6// Created: 26.05.99
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) wxWidgets Team
65571936 9// Licence: wxWindows licence
3f480da3
VZ
10///////////////////////////////////////////////////////////////////////////////
11
8b53e5a2
RR
12#ifndef _WX_DATAOBJ_H_BASE_
13#define _WX_DATAOBJ_H_BASE_
14
e1ee679c
VZ
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
e1ee679c 18#include "wx/defs.h"
49de4949
DE
19
20#if wxUSE_DATAOBJ
21
e1ee679c
VZ
22#include "wx/string.h"
23#include "wx/bitmap.h"
24#include "wx/list.h"
a6abcf2e 25#include "wx/arrstr.h"
e1ee679c
VZ
26
27// ============================================================================
28/*
29 Generic data transfer related classes. The class hierarchy is as follows:
30
31 - wxDataObject-
32 / \
33 / \
34 wxDataObjectSimple wxDataObjectComposite
35 / | \
36 / | \
37 wxTextDataObject | wxBitmapDataObject
38 |
39 wxCustomDataObject
40
41*/
42// ============================================================================
43
44// ----------------------------------------------------------------------------
45// wxDataFormat class is declared in platform-specific headers: it represents
46// a format for data which may be either one of the standard ones (text,
47// bitmap, ...) or a custom one which is then identified by a unique string.
48// ----------------------------------------------------------------------------
49
50/* the class interface looks like this (pseudo code):
51
52class wxDataFormat
53{
54public:
55 typedef <integral type> NativeFormat;
56
57 wxDataFormat(NativeFormat format = wxDF_INVALID);
a1eb65c2 58 wxDataFormat(const wxString& format);
e1ee679c
VZ
59
60 wxDataFormat& operator=(NativeFormat format);
61 wxDataFormat& operator=(const wxDataFormat& format);
62
63 bool operator==(NativeFormat format) const;
64 bool operator!=(NativeFormat format) const;
65
66 void SetType(NativeFormat format);
67 NativeFormat GetType() const;
68
69 wxString GetId() const;
a1eb65c2 70 void SetId(const wxString& format);
e1ee679c
VZ
71};
72
73*/
74
75#if defined(__WXMSW__)
76 #include "wx/msw/ole/dataform.h"
77#elif defined(__WXMOTIF__)
78 #include "wx/motif/dataform.h"
1be7a35c 79#elif defined(__WXGTK20__)
e1ee679c 80 #include "wx/gtk/dataform.h"
1be7a35c
MR
81#elif defined(__WXGTK__)
82 #include "wx/gtk1/dataform.h"
83df96d6
JS
83#elif defined(__WXX11__)
84 #include "wx/x11/dataform.h"
e7549107 85#elif defined(__WXMAC__)
ef0e9220 86 #include "wx/osx/dataform.h"
aa3d0277
DE
87#elif defined(__WXCOCOA__)
88 #include "wx/cocoa/dataform.h"
4004aba3
DW
89#elif defined(__WXPM__)
90 #include "wx/os2/dataform.h"
e1ee679c
VZ
91#endif
92
0c2b453f
VZ
93// the value for default argument to some functions (corresponds to
94// wxDF_INVALID)
53a2db12 95extern WXDLLIMPEXP_CORE const wxDataFormat& wxFormatInvalid;
0c2b453f 96
e1ee679c
VZ
97// ----------------------------------------------------------------------------
98// wxDataObject represents a piece of data which knows which formats it
99// supports and knows how to render itself in each of them - GetDataHere(),
100// and how to restore data from the buffer (SetData()).
101//
102// Although this class may be used directly (i.e. custom classes may be
103// derived from it), in many cases it might be simpler to use either
104// wxDataObjectSimple or wxDataObjectComposite classes.
105//
106// A data object may be "read only", i.e. support only GetData() functions or
107// "read-write", i.e. support both GetData() and SetData() (in principle, it
108// might be "write only" too, but this is rare). Moreover, it doesn't have to
109// support the same formats in Get() and Set() directions: for example, a data
110// object containing JPEG image might accept BMPs in GetData() because JPEG
111// image may be easily transformed into BMP but not in SetData(). Accordingly,
112// all methods dealing with formats take an additional "direction" argument
113// which is either SET or GET and which tells the function if the format needs
114// to be supported by SetData() or GetDataHere().
115// ----------------------------------------------------------------------------
116
53a2db12 117class WXDLLIMPEXP_CORE wxDataObjectBase
e1ee679c
VZ
118{
119public:
120 enum Direction
121 {
122 Get = 0x01, // format is supported by GetDataHere()
123 Set = 0x02, // format is supported by SetData()
124 Both = 0x03 // format is supported by both (unused currently)
125 };
126
127 // this class is polymorphic, hence it needs a virtual dtor
128 virtual ~wxDataObjectBase();
129
130 // get the best suited format for rendering our data
131 virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const = 0;
132
133 // get the number of formats we support
134 virtual size_t GetFormatCount(Direction dir = Get) const = 0;
135
136 // return all formats in the provided array (of size GetFormatCount())
137 virtual void GetAllFormats(wxDataFormat *formats,
138 Direction dir = Get) const = 0;
139
140 // get the (total) size of data for the given format
141 virtual size_t GetDataSize(const wxDataFormat& format) const = 0;
142
143 // copy raw data (in the specified format) to the provided buffer, return
68379eaf 144 // true if data copied successfully, false otherwise
e1ee679c
VZ
145 virtual bool GetDataHere(const wxDataFormat& format, void *buf) const = 0;
146
147 // get data from the buffer of specified length (in the given format),
68379eaf 148 // return true if the data was read successfully, false otherwise
f2491e2d
VZ
149 virtual bool SetData(const wxDataFormat& WXUNUSED(format),
150 size_t WXUNUSED(len), const void * WXUNUSED(buf))
9e2896e5 151 {
68379eaf 152 return false;
9e2896e5 153 }
d9317fd4 154
68379eaf 155 // returns true if this format is supported
d9317fd4 156 bool IsSupported(const wxDataFormat& format, Direction dir = Get) const;
e1ee679c
VZ
157};
158
159// ----------------------------------------------------------------------------
160// include the platform-specific declarations of wxDataObject
161// ----------------------------------------------------------------------------
162
8b53e5a2 163#if defined(__WXMSW__)
3f480da3 164 #include "wx/msw/ole/dataobj.h"
8b53e5a2 165#elif defined(__WXMOTIF__)
3f480da3 166 #include "wx/motif/dataobj.h"
7266b672
JS
167#elif defined(__WXX11__)
168 #include "wx/x11/dataobj.h"
d74c6a95 169#elif defined(__WXGTK20__)
3f480da3 170 #include "wx/gtk/dataobj.h"
d74c6a95
MW
171#elif defined(__WXGTK__)
172 #include "wx/gtk1/dataobj.h"
8b53e5a2 173#elif defined(__WXMAC__)
ef0e9220 174 #include "wx/osx/dataobj.h"
aa3d0277
DE
175#elif defined(__WXCOCOA__)
176 #include "wx/cocoa/dataobj.h"
1777b9bb 177#elif defined(__WXPM__)
6dddc146 178 #include "wx/os2/dataobj.h"
8b53e5a2
RR
179#endif
180
e1ee679c
VZ
181// ----------------------------------------------------------------------------
182// wxDataObjectSimple is a wxDataObject which only supports one format (in
68379eaf 183// both Get and Set directions, but you may return false from GetDataHere() or
e1ee679c
VZ
184// SetData() if one of them is not supported). This is the simplest possible
185// wxDataObject implementation.
186//
187// This is still an "abstract base class" (although it doesn't have any pure
188// virtual functions), to use it you should derive from it and implement
189// GetDataSize(), GetDataHere() and SetData() functions because the base class
190// versions don't do anything - they just return "not implemented".
191//
192// This class should be used when you provide data in only one format (no
193// conversion to/from other formats), either a standard or a custom one.
194// Otherwise, you should use wxDataObjectComposite or wxDataObject directly.
195// ----------------------------------------------------------------------------
3f480da3 196
53a2db12 197class WXDLLIMPEXP_CORE wxDataObjectSimple : public wxDataObject
3f480da3 198{
e1ee679c
VZ
199public:
200 // ctor takes the format we support, but it can also be set later with
201 // SetFormat()
1e8335b0 202 wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid)
e1ee679c
VZ
203 : m_format(format)
204 {
205 }
206
207 // get/set the format we support
208 const wxDataFormat& GetFormat() const { return m_format; }
209 void SetFormat(const wxDataFormat& format) { m_format = format; }
210
211 // virtual functions to override in derived class (the base class versions
212 // just return "not implemented")
213 // -----------------------------------------------------------------------
214
215 // get the size of our data
216 virtual size_t GetDataSize() const
217 { return 0; }
3f480da3 218
e1ee679c
VZ
219 // copy our data to the buffer
220 virtual bool GetDataHere(void *WXUNUSED(buf)) const
68379eaf 221 { return false; }
e1ee679c
VZ
222
223 // copy data from buffer to our data
e30d5976 224 virtual bool SetData(size_t WXUNUSED(len), const void *WXUNUSED(buf))
68379eaf 225 { return false; }
e1ee679c
VZ
226
227 // implement base class pure virtuals
228 // ----------------------------------
4004aba3 229 virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
e1ee679c 230 { return m_format; }
4004aba3 231 virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
e1ee679c
VZ
232 { return 1; }
233 virtual void GetAllFormats(wxDataFormat *formats,
4004aba3 234 wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
e1ee679c
VZ
235 { *formats = m_format; }
236 virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const
237 { return GetDataSize(); }
238 virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
239 void *buf) const
240 { return GetDataHere(buf); }
241 virtual bool SetData(const wxDataFormat& WXUNUSED(format),
242 size_t len, const void *buf)
243 { return SetData(len, buf); }
244
245private:
246 // the one and only format we support
247 wxDataFormat m_format;
fc7a2a60 248
c0c133e1 249 wxDECLARE_NO_COPY_CLASS(wxDataObjectSimple);
e1ee679c
VZ
250};
251
252// ----------------------------------------------------------------------------
253// wxDataObjectComposite is the simplest way to implement wxDataObject
254// supporting multiple formats. It contains several wxDataObjectSimple and
255// supports all formats supported by any of them.
256//
257// This class shouldn't be (normally) derived from, but may be used directly.
258// If you need more flexibility than what it provides, you should probably use
259// wxDataObject directly.
260// ----------------------------------------------------------------------------
261
f6bcfd97 262WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
e1ee679c 263
53a2db12 264class WXDLLIMPEXP_CORE wxDataObjectComposite : public wxDataObject
e1ee679c 265{
3f480da3 266public:
e1ee679c 267 // ctor
e6b01b78 268 wxDataObjectComposite();
222ed1d6 269 virtual ~wxDataObjectComposite();
e1ee679c
VZ
270
271 // add data object (it will be deleted by wxDataObjectComposite, hence it
272 // must be allocated on the heap) whose format will become the preferred
68379eaf
WS
273 // one if preferred == true
274 void Add(wxDataObjectSimple *dataObject, bool preferred = false);
3f480da3 275
c072c757 276 // Report the format passed to the SetData method. This should be the
1d4b9c37 277 // format of the data object within the composite that received data from
c072c757 278 // the clipboard or the DnD operation. You can use this method to find
1d4b9c37 279 // out what kind of data object was received.
c072c757
RD
280 wxDataFormat GetReceivedFormat() const;
281
1d4b9c37
VZ
282 // Returns the pointer to the object which supports this format or NULL.
283 // The returned pointer is owned by wxDataObjectComposite and must
284 // therefore not be destroyed by the caller.
285 wxDataObjectSimple *GetObject(const wxDataFormat& format,
286 wxDataObjectBase::Direction dir = Get) const;
287
e1ee679c
VZ
288 // implement base class pure virtuals
289 // ----------------------------------
4004aba3
DW
290 virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const;
291 virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const;
292 virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const;
e1ee679c
VZ
293 virtual size_t GetDataSize(const wxDataFormat& format) const;
294 virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
295 virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf);
e1b435af
MB
296#if defined(__WXMSW__)
297 virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size,
298 const wxDataFormat& format );
299 virtual void* SetSizeInBuffer( void* buffer, size_t size,
300 const wxDataFormat& format );
301 virtual size_t GetBufferOffset( const wxDataFormat& format );
302#endif
3f480da3 303
e1ee679c
VZ
304private:
305 // the list of all (simple) data objects whose formats we support
306 wxSimpleDataObjectList m_dataObjects;
3f480da3 307
e1ee679c
VZ
308 // the index of the preferred one (0 initially, so by default the first
309 // one is the preferred)
310 size_t m_preferred;
fc7a2a60 311
c072c757
RD
312 wxDataFormat m_receivedFormat;
313
c0c133e1 314 wxDECLARE_NO_COPY_CLASS(wxDataObjectComposite);
e1ee679c 315};
3f480da3 316
e1ee679c
VZ
317// ============================================================================
318// Standard implementations of wxDataObjectSimple which can be used directly
319// (i.e. without having to derive from them) for standard data type transfers.
320//
321// Note that although all of them can work with provided data, you can also
322// override their virtual GetXXX() functions to only provide data on demand.
323// ============================================================================
3f480da3 324
e1ee679c
VZ
325// ----------------------------------------------------------------------------
326// wxTextDataObject contains text data
327// ----------------------------------------------------------------------------
3f480da3 328
98ecad06
VZ
329#if wxUSE_UNICODE
330 #if defined(__WXGTK20__)
331 #define wxNEEDS_UTF8_FOR_TEXT_DATAOBJ
332 #elif defined(__WXMAC__)
a25a1773 333 #define wxNEEDS_UTF16_FOR_TEXT_DATAOBJ
98ecad06
VZ
334 #endif
335#endif // wxUSE_UNICODE
336
b8acf11e
RD
337class WXDLLIMPEXP_CORE wxHTMLDataObject : public wxDataObjectSimple
338{
339public:
340 // ctor: you can specify the text here or in SetText(), or override
341 // GetText()
342 wxHTMLDataObject(const wxString& html = wxEmptyString)
343 : wxDataObjectSimple(wxDF_HTML),
344 m_html(html)
345 {
346 }
347
348 // virtual functions which you may override if you want to provide text on
349 // demand only - otherwise, the trivial default versions will be used
350 virtual size_t GetLength() const { return m_html.Len() + 1; }
351 virtual wxString GetHTML() const { return m_html; }
352 virtual void SetHTML(const wxString& html) { m_html = html; }
353
354 virtual size_t GetDataSize() const;
355 virtual bool GetDataHere(void *buf) const;
356 virtual bool SetData(size_t len, const void *buf);
357
358 // Must provide overloads to avoid hiding them (and warnings about it)
359 virtual size_t GetDataSize(const wxDataFormat&) const
360 {
361 return GetDataSize();
362 }
363 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
364 {
365 return GetDataHere(buf);
366 }
367 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
368 {
369 return SetData(len, buf);
370 }
371
372private:
373 wxString m_html;
374};
375
53a2db12 376class WXDLLIMPEXP_CORE wxTextDataObject : public wxDataObjectSimple
e1ee679c
VZ
377{
378public:
379 // ctor: you can specify the text here or in SetText(), or override
380 // GetText()
381 wxTextDataObject(const wxString& text = wxEmptyString)
17a1ebd1
VZ
382 : wxDataObjectSimple(
383#if wxUSE_UNICODE
384 wxDF_UNICODETEXT
385#else
386 wxDF_TEXT
387#endif
388 ),
e1b435af 389 m_text(text)
e1ee679c
VZ
390 {
391 }
3f480da3 392
e1ee679c
VZ
393 // virtual functions which you may override if you want to provide text on
394 // demand only - otherwise, the trivial default versions will be used
395 virtual size_t GetTextLength() const { return m_text.Len() + 1; }
396 virtual wxString GetText() const { return m_text; }
397 virtual void SetText(const wxString& text) { m_text = text; }
398
399 // implement base class pure virtuals
400 // ----------------------------------
c7d6d883 401
17a1ebd1 402 // some platforms have 2 and not 1 format for text data
98ecad06 403#if defined(wxNEEDS_UTF8_FOR_TEXT_DATAOBJ) || defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ)
25758297
SC
404 virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
405 virtual void GetAllFormats(wxDataFormat *formats,
406 wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;
407
408 virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); }
409 virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); }
410 virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); }
411
c7d6d883
RR
412 size_t GetDataSize(const wxDataFormat& format) const;
413 bool GetDataHere(const wxDataFormat& format, void *pBuf) const;
414 bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf);
98ecad06 415#else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ
e1ee679c
VZ
416 virtual size_t GetDataSize() const;
417 virtual bool GetDataHere(void *buf) const;
418 virtual bool SetData(size_t len, const void *buf);
6f02a879
VZ
419 // Must provide overloads to avoid hiding them (and warnings about it)
420 virtual size_t GetDataSize(const wxDataFormat&) const
421 {
422 return GetDataSize();
423 }
424 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
425 {
426 return GetDataHere(buf);
427 }
428 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
429 {
430 return SetData(len, buf);
431 }
98ecad06 432#endif // different wxTextDataObject implementations
fc7a2a60 433
c7d6d883
RR
434private:
435 wxString m_text;
68379eaf 436
c0c133e1 437 wxDECLARE_NO_COPY_CLASS(wxTextDataObject);
e1ee679c 438};
3f480da3 439
e1ee679c
VZ
440// ----------------------------------------------------------------------------
441// wxBitmapDataObject contains a bitmap
442// ----------------------------------------------------------------------------
3f480da3 443
53a2db12 444class WXDLLIMPEXP_CORE wxBitmapDataObjectBase : public wxDataObjectSimple
e1ee679c
VZ
445{
446public:
447 // ctor: you can specify the bitmap here or in SetBitmap(), or override
448 // GetBitmap()
449 wxBitmapDataObjectBase(const wxBitmap& bitmap = wxNullBitmap)
450 : wxDataObjectSimple(wxDF_BITMAP), m_bitmap(bitmap)
451 {
452 }
453
454 // virtual functions which you may override if you want to provide data on
455 // demand only - otherwise, the trivial default versions will be used
456 virtual wxBitmap GetBitmap() const { return m_bitmap; }
457 virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
458
b068c4e8 459protected:
e1ee679c 460 wxBitmap m_bitmap;
fc7a2a60 461
c0c133e1 462 wxDECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase);
e1ee679c
VZ
463};
464
465// ----------------------------------------------------------------------------
466// wxFileDataObject contains a list of filenames
9e2896e5
VZ
467//
468// NB: notice that this is a "write only" object, it can only be filled with
469// data from drag and drop operation.
e1ee679c
VZ
470// ----------------------------------------------------------------------------
471
53a2db12 472class WXDLLIMPEXP_CORE wxFileDataObjectBase : public wxDataObjectSimple
e1ee679c
VZ
473{
474public:
9e2896e5 475 // ctor: use AddFile() later to fill the array
e1ee679c
VZ
476 wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { }
477
9e2896e5 478 // get a reference to our array
b068c4e8 479 const wxArrayString& GetFilenames() const { return m_filenames; }
e1ee679c 480
9e2896e5 481protected:
e1ee679c 482 wxArrayString m_filenames;
6dddc146 483
c0c133e1 484 wxDECLARE_NO_COPY_CLASS(wxFileDataObjectBase);
e1ee679c
VZ
485};
486
487// ----------------------------------------------------------------------------
488// wxCustomDataObject contains arbitrary untyped user data.
489//
490// It is understood that this data can be copied bitwise.
491// ----------------------------------------------------------------------------
492
53a2db12 493class WXDLLIMPEXP_CORE wxCustomDataObject : public wxDataObjectSimple
e1ee679c
VZ
494{
495public:
496 // if you don't specify the format in the ctor, you can still use
497 // SetFormat() later
0c2b453f 498 wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid);
e1ee679c
VZ
499
500 // the dtor calls Free()
501 virtual ~wxCustomDataObject();
502
503 // you can call SetData() to set m_data: it will make a copy of the data
504 // you pass - or you can use TakeData() which won't copy anything, but
505 // will take ownership of data (i.e. will call Free() on it later)
506 void TakeData(size_t size, void *data);
507
508 // this function is called to allocate "size" bytes of memory from
509 // SetData(). The default version uses operator new[].
510 virtual void *Alloc(size_t size);
511
512 // this function is called when the data is freed, you may override it to
513 // anything you want (or may be nothing at all). The default version calls
514 // operator delete[] on m_data
515 virtual void Free();
516
517 // get data: you may override these functions if you wish to provide data
518 // only when it's requested
519 virtual size_t GetSize() const { return m_size; }
520 virtual void *GetData() const { return m_data; }
521
522 // implement base class pure virtuals
523 // ----------------------------------
524 virtual size_t GetDataSize() const;
525 virtual bool GetDataHere(void *buf) const;
526 virtual bool SetData(size_t size, const void *buf);
6f02a879
VZ
527 // Must provide overloads to avoid hiding them (and warnings about it)
528 virtual size_t GetDataSize(const wxDataFormat&) const
529 {
530 return GetDataSize();
531 }
532 virtual bool GetDataHere(const wxDataFormat&, void *buf) const
533 {
534 return GetDataHere(buf);
535 }
536 virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
537 {
538 return SetData(len, buf);
539 }
e1ee679c
VZ
540
541private:
542 size_t m_size;
543 void *m_data;
6dddc146 544
c0c133e1 545 wxDECLARE_NO_COPY_CLASS(wxCustomDataObject);
3f480da3
VZ
546};
547
e1ee679c
VZ
548// ----------------------------------------------------------------------------
549// include platform-specific declarations of wxXXXBase classes
550// ----------------------------------------------------------------------------
3f480da3 551
e1ee679c
VZ
552#if defined(__WXMSW__)
553 #include "wx/msw/ole/dataobj2.h"
444ad3a7 554 // wxURLDataObject defined in msw/ole/dataobj2.h
d613be55
RR
555#elif defined(__WXGTK20__)
556 #include "wx/gtk/dataobj2.h"
557 // wxURLDataObject defined in msw/ole/dataobj2.h
558
03647350 559#else
d613be55 560 #if defined(__WXGTK__)
d74c6a95 561 #include "wx/gtk1/dataobj2.h"
9691c806
RR
562 #elif defined(__WXX11__)
563 #include "wx/x11/dataobj2.h"
dd38c875
MB
564 #elif defined(__WXMOTIF__)
565 #include "wx/motif/dataobj2.h"
444ad3a7 566 #elif defined(__WXMAC__)
ef0e9220 567 #include "wx/osx/dataobj2.h"
aa3d0277
DE
568 #elif defined(__WXCOCOA__)
569 #include "wx/cocoa/dataobj2.h"
444ad3a7
VZ
570 #elif defined(__WXPM__)
571 #include "wx/os2/dataobj2.h"
572 #endif
573
574 // wxURLDataObject is simply wxTextDataObject with a different name
53a2db12 575 class WXDLLIMPEXP_CORE wxURLDataObject : public wxTextDataObject
444ad3a7
VZ
576 {
577 public:
0463eea9
VZ
578 wxURLDataObject(const wxString& url = wxEmptyString)
579 : wxTextDataObject(url)
580 {
581 }
582
444ad3a7 583 wxString GetURL() const { return GetText(); }
e6d318c2 584 void SetURL(const wxString& url) { SetText(url); }
444ad3a7 585 };
d613be55 586#endif
e1ee679c 587
49de4949
DE
588#endif // wxUSE_DATAOBJ
589
e1ee679c 590#endif // _WX_DATAOBJ_H_BASE_