]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/txtdatob.tex
Reversed the meaning of black and white in wxRegion::ConvertToBitmap
[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
b2cf617c 4used without change to paste data into the \helpref{wxClipboard}{wxclipboard}
717a57c2
VZ
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
b2cf617c
JS
9as well be generated when requested. For this,
10\helpref{GetTextLength}{wxtextdataobjectgettextlength} and
717a57c2 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
b1462dfa 15already a very efficient operation (data is not actually copied because
717a57c2
VZ
16wxStrings are reference counted).
17
b1462dfa
RD
18\pythonnote{If you wish to create a derived wxTextDataObject class in
19wxPython you should derive the class from wxPyTextDataObject
20in order to get Python-aware capabilities for the various virtual
21methods.}
22
717a57c2
VZ
23\wxheading{Virtual functions to override}
24
b2cf617c 25This class may be used as is, but all of the data transfer functions may be
717a57c2 26overridden to increase efficiency.
dface61c
JS
27
28\wxheading{Derived from}
29
407f3681 30\helpref{wxDataObjectSimple}{wxdataobjectsimple}\\
dface61c
JS
31\helpref{wxDataObject}{wxdataobject}
32
954b8ae6
JS
33\wxheading{Include files}
34
35<wx/dataobj.h>
36
dface61c
JS
37\wxheading{See also}
38
b2cf617c
JS
39\helpref{Clipboard and drag and drop overview}{wxdndoverview},
40\helpref{wxDataObject}{wxdataobject},
41\helpref{wxDataObjectSimple}{wxdataobjectsimple},
42\helpref{wxFileDataObject}{wxfiledataobject},
717a57c2 43\helpref{wxBitmapDataObject}{wxbitmapdataobject}
dface61c
JS
44
45\latexignore{\rtfignore{\wxheading{Members}}}
46
47\membersection{wxTextDataObject::wxTextDataObject}\label{wxtextdataobjectwxtextdataobject}
48
717a57c2 49\func{}{wxTextDataObject}{\param{const wxString\& }{text = wxEmptyString}}
dface61c 50
b2cf617c 51Constructor, may be used to initialise the text (otherwise
407f3681 52\helpref{SetText}{wxtextdataobjectsettext} should be used later).
dface61c 53
717a57c2 54\membersection{wxTextDataObject::GetTextLength}\label{wxtextdataobjectgettextlength}
dface61c 55
717a57c2 56\constfunc{virtual size\_t}{GetTextLength}{\void}
ab272c0b
RR
57
58Returns the data size. By default, returns the size of the text data
59set in the constructor or using \helpref{SetText}{wxtextdataobjectsettext}.
60This can be overridden to provide text size data on-demand. It is recommended
61to return the text length plus 1 for a trailing zero, but this is not
62strictly required.
dface61c 63
ab272c0b
RR
64\membersection{wxTextDataObject::GetText}\label{wxtextdataobjectgettext}
65
66\constfunc{virtual wxString}{GetText}{\void}
dface61c 67
ab272c0b
RR
68Returns the text associated with the data object. You may wish to override
69this method when offering data on-demand, but this is not required by
70wxWindows' internals. Use this method to get data in text form from
71the \helpref{wxClipboard}{wxclipboard}.
dface61c
JS
72
73\membersection{wxTextDataObject::SetText}\label{wxtextdataobjectsettext}
74
75\func{virtual void}{SetText}{\param{const wxString\& }{strText}}
76
ab272c0b 77Sets the text associated with the data object. This method is called
717a57c2
VZ
78when the data object receives the data and, by default, copies the text into
79the member variable. If you want to process the text on the fly you may wish to
80override this function.
dface61c 81