]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/dataform.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / include / wx / osx / dataform.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/dataform.h
3 // Purpose: declaration of the wxDataFormat class
4 // Author: Stefan Csomor (lifted from dnd.h)
5 // Modified by:
6 // Created: 10/21/99
7 // Copyright: (c) 1999 Stefan Csomor
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MAC_DATAFORM_H
12 #define _WX_MAC_DATAFORM_H
13
14 class WXDLLIMPEXP_CORE wxDataFormat
15 {
16 public:
17 typedef unsigned long NativeFormat;
18
19 wxDataFormat();
20 wxDataFormat(wxDataFormatId vType);
21 wxDataFormat(const wxDataFormat& rFormat);
22 wxDataFormat(const wxString& rId);
23 wxDataFormat(const wxChar* pId);
24 wxDataFormat(NativeFormat vFormat);
25 ~wxDataFormat();
26
27 wxDataFormat& operator=(NativeFormat vFormat)
28 { SetId(vFormat); return *this; }
29
30 // comparison (must have both versions)
31 bool operator==(const wxDataFormat& format) const ;
32 bool operator!=(const wxDataFormat& format) const
33 { return ! ( *this == format ); }
34 bool operator==(wxDataFormatId format) const
35 { return m_type == (wxDataFormatId)format; }
36 bool operator!=(wxDataFormatId format) const
37 { return m_type != (wxDataFormatId)format; }
38
39 wxDataFormat& operator=(const wxDataFormat& 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& pId);
53
54 // implementation
55 wxDataFormatId GetType() const { return m_type; }
56 void SetType( wxDataFormatId type );
57
58 // returns true if the format is one of those defined in wxDataFormatId
59 bool IsStandard() const { return m_type > 0 && m_type < wxDF_PRIVATE; }
60
61 private:
62 wxDataFormatId m_type;
63 NativeFormat m_format;
64 // indicates the type in case of wxDF_PRIVATE :
65 wxString m_id ;
66 };
67
68 #endif // _WX_MAC_DATAFORM_H