1999-01-13 09:23:31 -05:00
|
|
|
\section{\class{wxTextDataObject}}\label{wxtextdataobject}
|
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
wxTextDataObject is a specialization of wxDataObject for text data. It can be
|
2000-03-17 12:59:56 -05:00
|
|
|
used without change to paste data into the \helpref{wxClipboard}{wxclipboard}
|
1999-11-01 20:25:43 -05:00
|
|
|
or a \helpref{wxDropSource}{wxdropsource}. A user may wish to derive a new
|
|
|
|
class from this class for providing text on-demand in order to minimize memory
|
|
|
|
consumption when offering data in several formats, such as plain text and RTF
|
|
|
|
because by default the text is stored in a string in this class, but it might
|
2000-03-17 12:59:56 -05:00
|
|
|
as well be generated when requested. For this,
|
|
|
|
\helpref{GetTextLength}{wxtextdataobjectgettextlength} and
|
1999-11-01 20:25:43 -05:00
|
|
|
\helpref{GetText}{wxtextdataobjectgettext} will have to be overridden.
|
1999-01-30 10:58:31 -05:00
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
Note that if you already have the text inside a string, you will not achieve
|
|
|
|
any efficiency gain by overriding these functions because copying wxStrings is
|
1999-11-06 03:30:23 -05:00
|
|
|
already a very efficient operation (data is not actually copied because
|
1999-11-01 20:25:43 -05:00
|
|
|
wxStrings are reference counted).
|
|
|
|
|
1999-11-06 03:30:23 -05:00
|
|
|
\pythonnote{If you wish to create a derived wxTextDataObject class in
|
|
|
|
wxPython you should derive the class from wxPyTextDataObject
|
|
|
|
in order to get Python-aware capabilities for the various virtual
|
|
|
|
methods.}
|
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
\wxheading{Virtual functions to override}
|
|
|
|
|
2000-03-17 12:59:56 -05:00
|
|
|
This class may be used as is, but all of the data transfer functions may be
|
1999-11-01 20:25:43 -05:00
|
|
|
overridden to increase efficiency.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
1999-11-02 05:02:01 -05:00
|
|
|
\helpref{wxDataObjectSimple}{wxdataobjectsimple}\\
|
1999-01-13 09:23:31 -05:00
|
|
|
\helpref{wxDataObject}{wxdataobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/dataobj.h>
|
|
|
|
|
1999-01-13 09:23:31 -05:00
|
|
|
\wxheading{See also}
|
|
|
|
|
2000-03-17 12:59:56 -05:00
|
|
|
\helpref{Clipboard and drag and drop overview}{wxdndoverview},
|
|
|
|
\helpref{wxDataObject}{wxdataobject},
|
|
|
|
\helpref{wxDataObjectSimple}{wxdataobjectsimple},
|
|
|
|
\helpref{wxFileDataObject}{wxfiledataobject},
|
1999-11-01 20:25:43 -05:00
|
|
|
\helpref{wxBitmapDataObject}{wxbitmapdataobject}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxTextDataObject::wxTextDataObject}\label{wxtextdataobjectwxtextdataobject}
|
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
\func{}{wxTextDataObject}{\param{const wxString\& }{text = wxEmptyString}}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
2000-03-17 12:59:56 -05:00
|
|
|
Constructor, may be used to initialise the text (otherwise
|
1999-11-02 05:02:01 -05:00
|
|
|
\helpref{SetText}{wxtextdataobjectsettext} should be used later).
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
\membersection{wxTextDataObject::GetTextLength}\label{wxtextdataobjectgettextlength}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
\constfunc{virtual size\_t}{GetTextLength}{\void}
|
1999-01-30 10:58:31 -05:00
|
|
|
|
|
|
|
Returns the data size. By default, returns the size of the text data
|
|
|
|
set in the constructor or using \helpref{SetText}{wxtextdataobjectsettext}.
|
|
|
|
This can be overridden to provide text size data on-demand. It is recommended
|
|
|
|
to return the text length plus 1 for a trailing zero, but this is not
|
|
|
|
strictly required.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
\membersection{wxTextDataObject::GetText}\label{wxtextdataobjectgettext}
|
|
|
|
|
|
|
|
\constfunc{virtual wxString}{GetText}{\void}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
Returns the text associated with the data object. You may wish to override
|
|
|
|
this method when offering data on-demand, but this is not required by
|
|
|
|
wxWindows' internals. Use this method to get data in text form from
|
|
|
|
the \helpref{wxClipboard}{wxclipboard}.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\membersection{wxTextDataObject::SetText}\label{wxtextdataobjectsettext}
|
|
|
|
|
|
|
|
\func{virtual void}{SetText}{\param{const wxString\& }{strText}}
|
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
Sets the text associated with the data object. This method is called
|
1999-11-01 20:25:43 -05:00
|
|
|
when the data object receives the data and, by default, copies the text into
|
|
|
|
the member variable. If you want to process the text on the fly you may wish to
|
|
|
|
override this function.
|
1999-01-13 09:23:31 -05:00
|
|
|
|