1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
<HTML>
<head><title>wxTextDataObject</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxtextdataobject"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx240.htm#wxtextctrl"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx242.htm#wxtextentrydialog"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxTextDataObject</H2>
<P>
wxTextDataObject is a specialization of wxDataObject for text data. It can be
used without change to paste data into the <A HREF="wx44.htm#wxclipboard">wxClipboard</A>
or a <A HREF="wx81.htm#wxdropsource">wxDropSource</A>. 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.<P>
In order to offer text data on-demand <A HREF="wx241.htm#wxtextdataobjectgetsize">GetSize</A>
and <A HREF="wx241.htm#wxtextdataobjectwritedata">WriteData</A> will have to be overridden.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx61.htm#wxdataobject">wxDataObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/dataobj.h><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx61.htm#wxdataobject">wxDataObject</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxtextdataobjectwxtextdataobject">wxTextDataObject::wxTextDataObject</A><BR>
<A HREF="#wxtextdataobjectgetsize">wxTextDataObject::GetSize</A><BR>
<A HREF="#wxtextdataobjectgettext">wxTextDataObject::GetText</A><BR>
<A HREF="#wxtextdataobjectsettext">wxTextDataObject::SetText</A><BR>
<A HREF="#wxtextdataobjectwritedata">wxTextDataObject::WriteData</A><BR>
<A HREF="#wxtextdataobjectwritestring">wxTextDataObject::WriteString</A><BR>
<P>
<HR>
<A NAME="wxtextdataobjectwxtextdataobject"></A>
<H3>wxTextDataObject::wxTextDataObject</H3>
<P>
<B></B> <B>wxTextDataObject</B>()<P>
Default constructor. Call <A HREF="wx241.htm#wxtextdataobjectsettext">SetText</A> later
or override <A HREF="wx241.htm#wxtextdataobjectwritedata">WriteData</A> and
<A HREF="wx241.htm#wxtextdataobjectgetsize">GetSize</A> for providing data on-demand.<P>
<B></B> <B>wxTextDataObject</B>(<B>const wxString& </B><I>strText</I>)<P>
Constructor, passing text.<P>
<HR>
<A NAME="wxtextdataobjectgetsize"></A>
<H3>wxTextDataObject::GetSize</H3>
<P>
<B>virtual size_t</B> <B>GetSize</B>() <B>const</B><P>
Returns the data size. By default, returns the size of the text data
set in the constructor or using <A HREF="wx241.htm#wxtextdataobjectsettext">SetText</A>.
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.<P>
<HR>
<A NAME="wxtextdataobjectgettext"></A>
<H3>wxTextDataObject::GetText</H3>
<P>
<B>virtual wxString</B> <B>GetText</B>() <B>const</B><P>
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 <A HREF="wx44.htm#wxclipboard">wxClipboard</A>.<P>
<HR>
<A NAME="wxtextdataobjectsettext"></A>
<H3>wxTextDataObject::SetText</H3>
<P>
<B>virtual void</B> <B>SetText</B>(<B>const wxString& </B><I>strText</I>)<P>
Sets the text associated with the data object. This method is called
internally when retrieving data from the <A HREF="wx44.htm#wxclipboard">wxClipboard</A>
and may be used to paste data to the clipboard directly (instead of
on-demand).<P>
<HR>
<A NAME="wxtextdataobjectwritedata"></A>
<H3>wxTextDataObject::WriteData</H3>
<P>
<B>virtual void</B> <B>WriteData</B>(<B>void</B><I>*dest</I> ) <B>const</B><P>
Write the data owned by this class to <I>dest</I>. By default, this
calls <A HREF="wx241.htm#wxtextdataobjectwritestring">WriteString</A> with the string
set in the constructor or using <A HREF="wx241.htm#wxtextdataobjectsettext">SetText</A>.
This can be overridden to provide text data on-demand; in this case
<A HREF="wx241.htm#wxtextdataobjectwritestring">WriteString</A> must be called from
within the overriding WriteData() method.<P>
<HR>
<A NAME="wxtextdataobjectwritestring"></A>
<H3>wxTextDataObject::WriteString</H3>
<P>
<B>void</B> <B>WriteString</B>(<B>const wxString& </B><I>str</I><B>void</B><I>*dest</I> ) <B>const</B><P>
Writes the the string <I>str</I> to <I>dest</I>. This method must be called
from <A HREF="wx241.htm#wxtextdataobjectwritedata">WriteData</A>.<P>
</BODY></HTML>
|