]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/dataform.h
5d143ed9aaab9a8c36a4b1190dc00b3f52e56fd8
[wxWidgets.git] / include / wx / gtk1 / dataform.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/dataform.h
3 // Purpose: declaration of the wxDataFormat class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 19.10.99 (extracted from gtk/dataobj.h)
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GTK_DATAFORM_H
13 #define _WX_GTK_DATAFORM_H
14
15 class WXDLLIMPEXP_CORE wxDataFormat
16 {
17 public:
18 // the clipboard formats under GDK are GdkAtoms
19 typedef GdkAtom NativeFormat;
20
21 wxDataFormat();
22 wxDataFormat( wxDataFormatId type );
23 wxDataFormat( const wxString &id );
24 wxDataFormat( NativeFormat format );
25
26 wxDataFormat& operator=(const wxDataFormat& format)
27 { m_type = format.m_type; m_format = format.m_format; return *this; }
28 wxDataFormat& operator=(NativeFormat format)
29 { SetId(format); return *this; }
30
31 // comparison (must have both versions)
32 bool operator==(NativeFormat format) const
33 { return m_format == (NativeFormat)format; }
34 bool operator!=(NativeFormat format) const
35 { return m_format != (NativeFormat)format; }
36 bool operator==(wxDataFormatId format) const
37 { return m_type == (wxDataFormatId)format; }
38 bool operator!=(wxDataFormatId format) const
39 { return m_type != (wxDataFormatId)format; }
40
41 // explicit and implicit conversions to NativeFormat which is one of
42 // standard data types (implicit conversion is useful for preserving the
43 // compatibility with old code)
44 NativeFormat GetFormatId() const { return m_format; }
45 operator NativeFormat() const { return m_format; }
46
47 void SetId( NativeFormat format );
48
49 // string ids are used for custom types - this SetId() must be used for
50 // application-specific formats
51 wxString GetId() const;
52 void SetId( const wxString& id );
53
54 // implementation
55 wxDataFormatId GetType() const;
56 void SetType( wxDataFormatId type );
57
58 private:
59 wxDataFormatId m_type;
60 NativeFormat m_format;
61
62 void PrepareFormats();
63 };
64
65 #endif // _WX_GTK_DATAFORM_H