]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/txtdatob.tex
Some doc fixes
[wxWidgets.git] / docs / latex / wx / txtdatob.tex
CommitLineData
dface61c
JS
1\section{\class{wxTextDataObject}}\label{wxtextdataobject}
2
ab272c0b
RR
3wxTextDataObject is a specialization of wxDataObject for text data. It can be
4used without change to paste data into the \helpref{wxClipboard}{wxclipboard}
5or a \helpref{wxDropSource}{wxdropsource}. A user may wish to derive a new class
6from this class for providing text on-demand in order to minimize memory consumption
7when offering data in several formats, such as plain text and RTF.
8
9In order to offer text data on-demand \helpref{GetSize}{wxtextdataobjectgetsize}
10and \helpref{WriteData}{wxtextdataobjectwritedata} will have to be overridden.
dface61c
JS
11
12\wxheading{Derived from}
13
14\helpref{wxDataObject}{wxdataobject}
15
954b8ae6
JS
16\wxheading{Include files}
17
18<wx/dataobj.h>
19
dface61c
JS
20\wxheading{See also}
21
22\helpref{wxDataObject}{wxdataobject}
23
24\latexignore{\rtfignore{\wxheading{Members}}}
25
26\membersection{wxTextDataObject::wxTextDataObject}\label{wxtextdataobjectwxtextdataobject}
27
28\func{}{wxTextDataObject}{\void}
29
ab272c0b
RR
30Default constructor. Call \helpref{SetText}{wxtextdataobjectsettext} later
31or override \helpref{WriteData}{wxtextdataobjectwritedata} and
32\helpref{GetSize}{wxtextdataobjectgetsize} for providing data on-demand.
dface61c
JS
33
34\func{}{wxTextDataObject}{\param{const wxString\& }{strText}}
35
36Constructor, passing text.
37
ab272c0b
RR
38\membersection{wxTextDataObject::GetSize}\label{wxtextdataobjectgetsize}
39
40\constfunc{virtual size\_t}{GetSize}{\void}
41
42Returns the data size. By default, returns the size of the text data
43set in the constructor or using \helpref{SetText}{wxtextdataobjectsettext}.
44This can be overridden to provide text size data on-demand. It is recommended
45to return the text length plus 1 for a trailing zero, but this is not
46strictly required.
dface61c 47
ab272c0b
RR
48\membersection{wxTextDataObject::GetText}\label{wxtextdataobjectgettext}
49
50\constfunc{virtual wxString}{GetText}{\void}
dface61c 51
ab272c0b
RR
52Returns the text associated with the data object. You may wish to override
53this method when offering data on-demand, but this is not required by
54wxWindows' internals. Use this method to get data in text form from
55the \helpref{wxClipboard}{wxclipboard}.
dface61c
JS
56
57\membersection{wxTextDataObject::SetText}\label{wxtextdataobjectsettext}
58
59\func{virtual void}{SetText}{\param{const wxString\& }{strText}}
60
ab272c0b
RR
61Sets the text associated with the data object. This method is called
62internally when retrieving data from the \helpref{wxClipboard}{wxclipboard}
63and may be used to paste data to the clipboard directly (instead of
64on-demand).
dface61c 65
ab272c0b 66\membersection{wxTextDataObject::WriteData}\label{wxtextdataobjectwritedata}
dface61c 67
ab272c0b
RR
68\constfunc{virtual void}{WriteData}{\param{void}{*dest} }
69
70Write the data owned by this class to {\it dest}. By default, this
03ab016d 71calls \helpref{WriteString}{wxtextdataobjectwritestring} with the string
ab272c0b 72set in the constructor or using \helpref{SetText}{wxtextdataobjectsettext}.
03ab016d
JS
73This can be overridden to provide text data on-demand; in this case
74\helpref{WriteString}{wxtextdataobjectwritestring} must be called from
ab272c0b
RR
75within the overriding WriteData() method.
76
77\membersection{wxTextDataObject::WriteString}\label{wxtextdataobjectwritestring}
78
79\constfunc{void}{WriteString}{\param{const wxString\& }{str}\param{void}{*dest} }
dface61c 80
ab272c0b
RR
81Writes the the string {\it str} to {\it dest}. This method must be called
82from \helpref{WriteData}{wxtextdataobjectwritedata}.
dface61c 83