]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/ole/dataform.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / msw / ole / dataform.h
CommitLineData
e1ee679c 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/msw/ole/dataform.h
e1ee679c
VZ
3// Purpose: declaration of the wxDataFormat class
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 19.10.99 (extracted from msw/ole/dataobj.h)
e1ee679c 7// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 8// Licence: wxWindows licence
e1ee679c
VZ
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_MSW_OLE_DATAFORM_H
12#define _WX_MSW_OLE_DATAFORM_H
13
14// ----------------------------------------------------------------------------
15// wxDataFormat identifies the single format of data
16// ----------------------------------------------------------------------------
17
53a2db12 18class WXDLLIMPEXP_CORE wxDataFormat
e1ee679c
VZ
19{
20public:
33ac7e6f 21 // the clipboard formats under Win32 are WORD's
3922ecc9 22 typedef unsigned short NativeFormat;
e1ee679c
VZ
23
24 wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
aad27874
VZ
25
26 // we need constructors from all string types as implicit conversions to
27 // wxString don't apply when we already rely on implicit conversion of a,
28 // for example, "char *" string to wxDataFormat, and existing code does it
a1eb65c2 29 wxDataFormat(const wxString& format) { SetId(format); }
aad27874
VZ
30 wxDataFormat(const char *format) { SetId(format); }
31 wxDataFormat(const wchar_t *format) { SetId(format); }
32 wxDataFormat(const wxCStrData& format) { SetId(format); }
e1ee679c
VZ
33
34 wxDataFormat& operator=(NativeFormat format)
35 { m_format = format; return *this; }
36 wxDataFormat& operator=(const wxDataFormat& format)
37 { m_format = format.m_format; return *this; }
38
39 // default copy ctor/assignment operators ok
40
41 // comparison (must have both versions)
42 bool operator==(wxDataFormatId format) const
43 { return m_format == (NativeFormat)format; }
44 bool operator!=(wxDataFormatId format) const
45 { return m_format != (NativeFormat)format; }
46 bool operator==(const wxDataFormat& format) const
47 { return m_format == format.m_format; }
48 bool operator!=(const wxDataFormat& format) const
49 { return m_format != format.m_format; }
50
51 // explicit and implicit conversions to NativeFormat which is one of
52 // standard data types (implicit conversion is useful for preserving the
53 // compatibility with old code)
54 NativeFormat GetFormatId() const { return m_format; }
55 operator NativeFormat() const { return m_format; }
56
3922ecc9
VZ
57 // this works with standard as well as custom ids
58 void SetType(NativeFormat format) { m_format = format; }
59 NativeFormat GetType() const { return m_format; }
e1ee679c
VZ
60
61 // string ids are used for custom types - this SetId() must be used for
62 // application-specific formats
63 wxString GetId() const;
a1eb65c2 64 void SetId(const wxString& format);
e1ee679c 65
0a0e6a5b 66 // returns true if the format is one of those defined in wxDataFormatId
478d4ab7 67 bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; }
e1ee679c 68
3922ecc9 69private:
e1ee679c
VZ
70 NativeFormat m_format;
71};
72
73#endif // _WX_MSW_OLE_DATAFORM_H
74