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( const wxString
&id
);
24 wxDataFormat( const wxChar
*id
);
25 wxDataFormat( NativeFormat format
);
27 wxDataFormat
& operator=(const wxDataFormat
& format
)
28 { m_type
= format
.m_type
; m_format
= format
.m_format
; return *this; }
29 wxDataFormat
& operator=(NativeFormat format
)
30 { SetId(format
); return *this; }
32 // comparison (must have both versions)
33 bool operator==(NativeFormat format
) const
34 { return m_format
== (NativeFormat
)format
; }
35 bool operator!=(NativeFormat format
) const
36 { return m_format
!= (NativeFormat
)format
; }
37 bool operator==(wxDataFormatId format
) const
38 { return m_type
== (wxDataFormatId
)format
; }
39 bool operator!=(wxDataFormatId format
) const
40 { return m_type
!= (wxDataFormatId
)format
; }
42 // explicit and implicit conversions to NativeFormat which is one of
43 // standard data types (implicit conversion is useful for preserving the
44 // compatibility with old code)
45 NativeFormat
GetFormatId() const { return m_format
; }
46 operator NativeFormat() const { return m_format
; }
48 void SetId( NativeFormat format
);
50 // string ids are used for custom types - this SetId() must be used for
51 // application-specific formats
52 wxString
GetId() const;
53 void SetId( const wxChar
*id
);
56 wxDataFormatId
GetType() const;
57 void SetType( wxDataFormatId type
);
60 wxDataFormatId m_type
;
61 NativeFormat m_format
;
63 void PrepareFormats();
66 #endif // _WX_GTK_DATAFORM_H