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