]>
Commit | Line | Data |
---|---|---|
8cf73271 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 | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
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); | |
ebf2a1ec | 22 | wxDataFormat(const wxDataFormat& rFormat); |
8cf73271 | 23 | wxDataFormat(const wxString& rId); |
ebf2a1ec | 24 | wxDataFormat(const wxChar* pId); |
8cf73271 | 25 | wxDataFormat(NativeFormat vFormat); |
ebf2a1ec | 26 | ~wxDataFormat(); |
8cf73271 SC |
27 | |
28 | wxDataFormat& operator=(NativeFormat vFormat) | |
29 | { SetId(vFormat); return *this; } | |
30 | ||
31 | // comparison (must have both versions) | |
0b6db82f SC |
32 | bool operator==(const wxDataFormat& format) const ; |
33 | bool operator!=(const wxDataFormat& format) const | |
8f98c051 | 34 | { return ! ( *this == format ); } |
8cf73271 SC |
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 | ||
ebf2a1ec SC |
40 | wxDataFormat& operator=(const wxDataFormat& format); |
41 | ||
8cf73271 SC |
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; | |
a1eb65c2 | 53 | void SetId(const wxString& pId); |
8cf73271 SC |
54 | |
55 | // implementation | |
56 | wxDataFormatId GetType() const { return m_type; } | |
57 | void SetType( wxDataFormatId type ); | |
58 | ||
0b6db82f | 59 | // returns true if the format is one of those defined in wxDataFormatId |
7017fd67 | 60 | bool IsStandard() const { return m_type > 0 && m_type < wxDF_PRIVATE; } |
8f98c051 | 61 | |
8cf73271 SC |
62 | private: |
63 | wxDataFormatId m_type; | |
64 | NativeFormat m_format; | |
0b6db82f SC |
65 | // indicates the type in case of wxDF_PRIVATE : |
66 | wxString m_id ; | |
8cf73271 SC |
67 | }; |
68 | ||
69 | #endif // _WX_MAC_DATAFORM_H |