]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/custdobj.tex
wxDataViewCtrl DnD stubs, some reformating
[wxWidgets.git] / docs / latex / wx / custdobj.tex
... / ...
CommitLineData
1\section{\class{wxCustomDataObject}}\label{wxcustomdataobject}
2
3wxCustomDataObject is a specialization of
4\helpref{wxDataObjectSimple}{wxdataobjectsimple} for some
5application-specific data in arbitrary (either custom or one of the standard
6ones). The only restriction is that it is supposed that this data can be
7copied bitwise (i.e. with {\tt memcpy()}), so it would be a bad idea to make
8it contain a C++ object (though C struct is fine).
9
10By default, wxCustomDataObject stores the data inside in a buffer. To put the
11data into the buffer you may use either
12\helpref{SetData}{wxcustomdataobjectsetdata} or
13\helpref{TakeData}{wxcustomdataobjecttakedata} depending on whether you want
14the object to make a copy of data or not.
15
16If you already store the data in another place, it may be more convenient and
17efficient to provide the data on-demand which is possible too if you override
18the virtual functions mentioned below.
19
20\wxheading{Virtual functions to override}
21
22This class may be used as is, but if you don't want store the data inside the
23object but provide it on demand instead, you should override
24\helpref{GetSize}{wxcustomdataobjectgetsize},
25\helpref{GetData}{wxcustomdataobjectgetdata} and
26\helpref{SetData}{wxcustomdataobjectsetdata} (or may be only the first two or
27only the last one if you only allow reading/writing the data)
28
29\wxheading{Derived from}
30
31\helpref{wxDataObjectSimple}{wxdataobjectsimple}\\
32\helpref{wxDataObject}{wxdataobject}
33
34\wxheading{Include files}
35
36<wx/dataobj.h>
37
38\wxheading{Library}
39
40\helpref{wxCore}{librarieslist}
41
42\wxheading{See also}
43
44\helpref{wxDataObject}{wxdataobject}
45
46\latexignore{\rtfignore{\wxheading{Members}}}
47
48\membersection{wxCustomDataObject::wxCustomDataObject}\label{wxcustomdataobjectwxcustomdataobject}
49
50\func{}{wxCustomDataObject}{\param{const wxDataFormat\& }{format = wxFormatInvalid}}
51
52The constructor accepts a {\it format} argument which specifies the (single)
53format supported by this object. If it isn't set here,
54\helpref{SetFormat}{wxdataobjectsimplesetformat} should be used.
55
56\membersection{wxCustomDataObject::\destruct{wxCustomDataObject}}\label{wxcustomdataobjectdtor}
57
58\func{}{\destruct{wxCustomDataObject}}{\void}
59
60The destructor will free the data hold by the object. Notice that although it
61calls a virtual \helpref{Free()}{wxcustomdataobjectfree} function, the base
62class version will always be called (C++ doesn't allow calling virtual
63functions from constructors or destructors), so if you override {\tt Free()}, you
64should override the destructor in your class as well (which would probably
65just call the derived class' version of {\tt Free()}).
66
67\membersection{wxCustomDataObject::Alloc}\label{wxcustomdataobjectalloc}
68
69\func{virtual void *}{Alloc}{\param{size\_t }{size}}
70
71This function is called to allocate {\it size} bytes of memory from SetData().
72The default version just uses the operator new.
73
74\membersection{wxCustomDataObject::Free}\label{wxcustomdataobjectfree}
75
76\func{virtual void}{Free}{\void}
77
78This function is called when the data is freed, you may override it to anything
79you want (or may be nothing at all). The default version calls operator
80delete$[]$ on the data.
81
82\membersection{wxCustomDataObject::GetSize}\label{wxcustomdataobjectgetsize}
83
84\constfunc{virtual size\_t}{GetSize}{\void}
85
86Returns the data size in bytes.
87
88\membersection{wxCustomDataObject::GetData}\label{wxcustomdataobjectgetdata}
89
90\constfunc{virtual void *}{GetData}{\void}
91
92Returns a pointer to the data.
93
94\membersection{wxCustomDataObject::SetData}\label{wxcustomdataobjectsetdata}
95
96\func{virtual void}{SetData}{
97 \param{size\_t }{size}, \param{const void }{*data}}
98
99Set the data. The data object will make an internal copy.
100
101\pythonnote{This method expects a string in wxPython. You can pass
102nearly any object by pickling it first.}
103
104\membersection{wxCustomDataObject::TakeData}\label{wxcustomdataobjecttakedata}
105
106\func{virtual void}{TakeData}{
107 \param{size\_t }{size}, \param{const void }{*data}}
108
109Like \helpref{SetData}{wxcustomdataobjectsetdata}, but doesn't copy the data -
110instead the object takes ownership of the pointer.
111
112\pythonnote{This method expects a string in wxPython. You can pass
113nearly any object by pickling it first.}
114