1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/dataform.h
3 // Purpose: declaration of the wxDataFormat class
4 // Author: Vadim Zeitlin
6 // Created: 19.10.99 (extracted from gtk/dataobj.h)
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GTK_DATAFORM_H
13 #define _WX_GTK_DATAFORM_H
15 class WXDLLIMPEXP_CORE wxDataFormat
18 // the clipboard formats under GDK are GdkAtoms
19 typedef GdkAtom NativeFormat
;
22 wxDataFormat( wxDataFormatId type
);
23 wxDataFormat( NativeFormat format
);
25 // we have to provide all the overloads to allow using strings instead of
26 // data formats (as a lot of existing code does)
27 wxDataFormat( const wxString
& id
) { InitFromString(id
); }
28 wxDataFormat( const char *id
) { InitFromString(id
); }
29 wxDataFormat( const wchar_t *id
) { InitFromString(id
); }
30 wxDataFormat( const wxCStrData
& id
) { InitFromString(id
); }
33 wxDataFormat
& operator=(const wxDataFormat
& format
)
34 { m_type
= format
.m_type
; m_format
= format
.m_format
; return *this; }
35 wxDataFormat
& operator=(NativeFormat format
)
36 { SetId(format
); return *this; }
38 // comparison (must have both versions)
39 bool operator==(NativeFormat format
) const
40 { return m_format
== (NativeFormat
)format
; }
41 bool operator!=(NativeFormat format
) const
42 { return m_format
!= (NativeFormat
)format
; }
43 bool operator==(wxDataFormatId format
) const
44 { return m_type
== (wxDataFormatId
)format
; }
45 bool operator!=(wxDataFormatId format
) const
46 { return m_type
!= (wxDataFormatId
)format
; }
48 // explicit and implicit conversions to NativeFormat which is one of
49 // standard data types (implicit conversion is useful for preserving the
50 // compatibility with old code)
51 NativeFormat
GetFormatId() const { return m_format
; }
52 operator NativeFormat() const { return m_format
; }
54 void SetId( NativeFormat format
);
56 // string ids are used for custom types - this SetId() must be used for
57 // application-specific formats
58 wxString
GetId() const;
59 void SetId( const wxString
& id
);
62 wxDataFormatId
GetType() const;
63 void SetType( wxDataFormatId type
);
66 // common part of ctors from format name
67 void InitFromString(const wxString
& id
);
69 wxDataFormatId m_type
;
70 NativeFormat m_format
;
72 void PrepareFormats();
75 #endif // _WX_GTK_DATAFORM_H