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