1 \section{\class{wxTextDataObject
}}\label{wxtextdataobject
}
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.
9 In order to offer text data on-demand
\helpref{GetSize
}{wxtextdataobjectgetsize
}
10 and
\helpref{WriteData
}{wxtextdataobjectwritedata
} will have to be overridden.
12 \wxheading{Derived from
}
14 \helpref{wxDataObject
}{wxdataobject
}
16 \wxheading{Include files
}
22 \helpref{wxDataObject
}{wxdataobject
}
24 \latexignore{\rtfignore{\wxheading{Members
}}}
26 \membersection{wxTextDataObject::wxTextDataObject
}\label{wxtextdataobjectwxtextdataobject
}
28 \func{}{wxTextDataObject
}{\void}
30 Default constructor. Call
\helpref{SetText
}{wxtextdataobjectsettext
} later
31 or override
\helpref{WriteData
}{wxtextdataobjectwritedata
} and
32 \helpref{GetSize
}{wxtextdataobjectgetsize
} for providing data on-demand.
34 \func{}{wxTextDataObject
}{\param{const wxString\&
}{strText
}}
36 Constructor, passing text.
38 \membersection{wxTextDataObject::GetSize
}\label{wxtextdataobjectgetsize
}
40 \constfunc{virtual size
\_t}{GetSize
}{\void}
42 Returns the data size. By default, returns the size of the text data
43 set in the constructor or using
\helpref{SetText
}{wxtextdataobjectsettext
}.
44 This can be overridden to provide text size data on-demand. It is recommended
45 to return the text length plus
1 for a trailing zero, but this is not
48 \membersection{wxTextDataObject::GetText
}\label{wxtextdataobjectgettext
}
50 \constfunc{virtual wxString
}{GetText
}{\void}
52 Returns the text associated with the data object. You may wish to override
53 this method when offering data on-demand, but this is not required by
54 wxWindows' internals. Use this method to get data in text form from
55 the
\helpref{wxClipboard
}{wxclipboard
}.
57 \membersection{wxTextDataObject::SetText
}\label{wxtextdataobjectsettext
}
59 \func{virtual void
}{SetText
}{\param{const wxString\&
}{strText
}}
61 Sets the text associated with the data object. This method is called
62 internally when retrieving data from the
\helpref{wxClipboard
}{wxclipboard
}
63 and may be used to paste data to the clipboard directly (instead of
66 \membersection{wxTextDataObject::WriteData
}\label{wxtextdataobjectwritedata
}
68 \constfunc{virtual void
}{WriteData
}{\param{void
}{*dest
} }
70 Write the data owned by this class to
{\it dest
}. By default, this
71 calls
\helpref{WriteString
}{wxtextdataobjectwritestring
} with the string
72 set in the constructor or using
\helpref{SetText
}{wxtextdataobjectsettext
}.
73 This can be overridden to provide text data on-demand; in this case
74 \helpref{WriteString
}{wxtextdataobjectwritestring
} must be called from
75 within the overriding WriteData() method.
77 \membersection{wxTextDataObject::WriteString
}\label{wxtextdataobjectwritestring
}
79 \constfunc{void
}{WriteString
}{\param{const wxString\&
}{str
}\param{void
}{*dest
} }
81 Writes the the string
{\it str
} to
{\it dest
}. This method must be called
82 from
\helpref{WriteData
}{wxtextdataobjectwritedata
}.