]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/txtdatob.tex
added frame icon for HTMLhelp frame
[wxWidgets.git] / docs / latex / wx / txtdatob.tex
CommitLineData
dface61c
JS
1\section{\class{wxTextDataObject}}\label{wxtextdataobject}
2
ab272c0b 3wxTextDataObject is a specialization of wxDataObject for text data. It can be
717a57c2
VZ
4used without change to paste data into the \helpref{wxClipboard}{wxclipboard}
5or a \helpref{wxDropSource}{wxdropsource}. A user may wish to derive a new
6class from this class for providing text on-demand in order to minimize memory
7consumption when offering data in several formats, such as plain text and RTF
8because by default the text is stored in a string in this class, but it might
9as well be generated when requested. For this,
10\helpref{GetTextLength}{wxtextdataobjectgettextlength} and
11\helpref{GetText}{wxtextdataobjectgettext} will have to be overridden.
ab272c0b 12
717a57c2
VZ
13Note that if you already have the text inside a string, you will not achieve
14any efficiency gain by overriding these functions because copying wxStrings is
15already a very efficient operation (data is not actualyl copied because
16wxStrings are reference counted).
17
18\wxheading{Virtual functions to override}
19
20This class may be used as is, but all of data transfer functions may be
21overridden to increase efficiency.
dface61c
JS
22
23\wxheading{Derived from}
24
407f3681 25\helpref{wxDataObjectSimple}{wxdataobjectsimple}\\
dface61c
JS
26\helpref{wxDataObject}{wxdataobject}
27
954b8ae6
JS
28\wxheading{Include files}
29
30<wx/dataobj.h>
31
dface61c
JS
32\wxheading{See also}
33
717a57c2
VZ
34\helpref{Clipboard and drag and drop overview}{wxclipboardonfigoverview},
35\helpref{wxDataObject}{wxdataobject},
36\helpref{wxDataObjectSimple}{wxdataobjectsimple},
37\helpref{wxFileDataObject}{wxfiledataobject},
38\helpref{wxBitmapDataObject}{wxbitmapdataobject}
dface61c
JS
39
40\latexignore{\rtfignore{\wxheading{Members}}}
41
42\membersection{wxTextDataObject::wxTextDataObject}\label{wxtextdataobjectwxtextdataobject}
43
717a57c2 44\func{}{wxTextDataObject}{\param{const wxString\& }{text = wxEmptyString}}
dface61c 45
717a57c2 46Constructor, may be used to initialise the text (otherwise
407f3681 47\helpref{SetText}{wxtextdataobjectsettext} should be used later).
dface61c 48
717a57c2 49\membersection{wxTextDataObject::GetTextLength}\label{wxtextdataobjectgettextlength}
dface61c 50
717a57c2 51\constfunc{virtual size\_t}{GetTextLength}{\void}
ab272c0b
RR
52
53Returns the data size. By default, returns the size of the text data
54set in the constructor or using \helpref{SetText}{wxtextdataobjectsettext}.
55This can be overridden to provide text size data on-demand. It is recommended
56to return the text length plus 1 for a trailing zero, but this is not
57strictly required.
dface61c 58
ab272c0b
RR
59\membersection{wxTextDataObject::GetText}\label{wxtextdataobjectgettext}
60
61\constfunc{virtual wxString}{GetText}{\void}
dface61c 62
ab272c0b
RR
63Returns the text associated with the data object. You may wish to override
64this method when offering data on-demand, but this is not required by
65wxWindows' internals. Use this method to get data in text form from
66the \helpref{wxClipboard}{wxclipboard}.
dface61c
JS
67
68\membersection{wxTextDataObject::SetText}\label{wxtextdataobjectsettext}
69
70\func{virtual void}{SetText}{\param{const wxString\& }{strText}}
71
ab272c0b 72Sets the text associated with the data object. This method is called
717a57c2
VZ
73when the data object receives the data and, by default, copies the text into
74the member variable. If you want to process the text on the fly you may wish to
75override this function.
dface61c 76