]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/dataform.h
added wx_truncate_cast and use it (sometimes instead of wx_static_cast) to explicitel...
[wxWidgets.git] / include / wx / mac / carbon / dataform.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: mac/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 // RCS-ID: $Id$
8 // Copyright: (c) 1999 Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MAC_DATAFORM_H
13 #define _WX_MAC_DATAFORM_H
14
15 class WXDLLEXPORT wxDataFormat
16 {
17 public:
18 typedef unsigned long NativeFormat;
19
20 wxDataFormat();
21 wxDataFormat(wxDataFormatId vType);
22 wxDataFormat(const wxString& rId);
23 wxDataFormat(const wxChar* pId);
24 wxDataFormat(NativeFormat vFormat);
25
26 wxDataFormat& operator=(NativeFormat vFormat)
27 { SetId(vFormat); return *this; }
28
29 // comparison (must have both versions)
30 bool operator==(const wxDataFormat& format) const ;
31 bool operator!=(const wxDataFormat& format) const
32 { return ! ( *this != format ); }
33 bool operator==(wxDataFormatId format) const
34 { return m_type == (wxDataFormatId)format; }
35 bool operator!=(wxDataFormatId format) const
36 { return m_type != (wxDataFormatId)format; }
37
38 // explicit and implicit conversions to NativeFormat which is one of
39 // standard data types (implicit conversion is useful for preserving the
40 // compatibility with old code)
41 NativeFormat GetFormatId() const { return m_format; }
42 operator NativeFormat() const { return m_format; }
43
44 void SetId(NativeFormat format);
45
46 // string ids are used for custom types - this SetId() must be used for
47 // application-specific formats
48 wxString GetId() const;
49 void SetId(const wxChar* pId);
50
51 // implementation
52 wxDataFormatId GetType() const { return m_type; }
53 void SetType( wxDataFormatId type );
54
55 // returns true if the format is one of those defined in wxDataFormatId
56 bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; }
57 private:
58 wxDataFormatId m_type;
59 NativeFormat m_format;
60 // indicates the type in case of wxDF_PRIVATE :
61 wxString m_id ;
62 };
63
64 #endif // _WX_MAC_DATAFORM_H