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