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