]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/ole/dataform.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/ole/dataform.h
3 // Purpose: declaration of the wxDataFormat class
4 // Author: Vadim Zeitlin
6 // Created: 19.10.99 (extracted from msw/ole/dataobj.h)
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSW_OLE_DATAFORM_H
13 #define _WX_MSW_OLE_DATAFORM_H
15 // ----------------------------------------------------------------------------
16 // wxDataFormat identifies the single format of data
17 // ----------------------------------------------------------------------------
19 class WXDLLEXPORT wxDataFormat
22 // the clipboard formats under Win32 are WORD's
23 typedef unsigned short NativeFormat
;
25 wxDataFormat(NativeFormat format
= wxDF_INVALID
) { m_format
= format
; }
26 wxDataFormat(const wxChar
*format
) { SetId(format
); }
28 wxDataFormat
& operator=(NativeFormat format
)
29 { m_format
= format
; return *this; }
30 wxDataFormat
& operator=(const wxDataFormat
& format
)
31 { m_format
= format
.m_format
; return *this; }
33 // default copy ctor/assignment operators ok
35 // comparison (must have both versions)
36 bool operator==(wxDataFormatId format
) const
37 { return m_format
== (NativeFormat
)format
; }
38 bool operator!=(wxDataFormatId format
) const
39 { return m_format
!= (NativeFormat
)format
; }
40 bool operator==(const wxDataFormat
& format
) const
41 { return m_format
== format
.m_format
; }
42 bool operator!=(const wxDataFormat
& format
) const
43 { return m_format
!= format
.m_format
; }
45 // explicit and implicit conversions to NativeFormat which is one of
46 // standard data types (implicit conversion is useful for preserving the
47 // compatibility with old code)
48 NativeFormat
GetFormatId() const { return m_format
; }
49 operator NativeFormat() const { return m_format
; }
51 // this works with standard as well as custom ids
52 void SetType(NativeFormat format
) { m_format
= format
; }
53 NativeFormat
GetType() const { return m_format
; }
55 // string ids are used for custom types - this SetId() must be used for
56 // application-specific formats
57 wxString
GetId() const;
58 void SetId(const wxChar
*format
);
60 // returns TRUE if the format is one of those defined in wxDataFormatId
61 bool IsStandard() const { return m_format
> 0 && m_format
< wxDF_PRIVATE
; }
64 NativeFormat m_format
;
67 #endif // _WX_MSW_OLE_DATAFORM_H