]>
Commit | Line | Data |
---|---|---|
6762286d SC |
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 WXDLLIMPEXP_CORE wxDataFormat | |
16 | { | |
17 | public: | |
18 | typedef unsigned long NativeFormat; | |
19 | ||
20 | wxDataFormat(); | |
21 | wxDataFormat(wxDataFormatId vType); | |
22 | wxDataFormat(const wxDataFormat& rFormat); | |
23 | wxDataFormat(const wxString& rId); | |
24 | wxDataFormat(const wxChar* pId); | |
25 | wxDataFormat(NativeFormat vFormat); | |
26 | ~wxDataFormat(); | |
27 | ||
28 | wxDataFormat& operator=(NativeFormat vFormat) | |
29 | { SetId(vFormat); return *this; } | |
30 | ||
31 | // comparison (must have both versions) | |
32 | bool operator==(const wxDataFormat& format) const ; | |
33 | bool operator!=(const wxDataFormat& format) const | |
34 | { return ! ( *this == 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 | wxDataFormat& operator=(const wxDataFormat& format); | |
41 | ||
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; } | |
47 | ||
48 | void SetId(NativeFormat format); | |
49 | ||
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 wxString& pId); | |
54 | ||
55 | // implementation | |
56 | wxDataFormatId GetType() const { return m_type; } | |
57 | void SetType( wxDataFormatId type ); | |
58 | ||
59 | // returns true if the format is one of those defined in wxDataFormatId | |
60 | bool IsStandard() const { return m_type > 0 && m_type < wxDF_PRIVATE; } | |
61 | ||
62 | private: | |
63 | wxDataFormatId m_type; | |
64 | NativeFormat m_format; | |
65 | // indicates the type in case of wxDF_PRIVATE : | |
66 | wxString m_id ; | |
67 | }; | |
68 | ||
69 | #endif // _WX_MAC_DATAFORM_H |