%% Created: 18.10.99
%% RCS-ID: $Id$
%% Copyright: (c) wxWindows team
-%% Licence: wxWindows licence
+%% License: wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\class{wxDataObject}}\label{wxdataobject}
};
\end{verbatim}
-which allows to distinguish between them. See
+which allows to distinguish between them. See
\helpref{wxDataFormat}{wxdataformat} documentation for more about formats.
-Not surprizingly, being 'smart' comes at a price of added complexity. This is
+Not surprisingly, being 'smart' comes at a price of added complexity. This is
reasonable for the situations when you really need to support multiple formats,
but may be annoying if you only want to do something simple like cut and paste
text.
To provide a solution for both cases, wxWindows has two predefined classes
-which derive from wxDataObject: \helpref{wxDataObjectSimple}{wxdataobjectsimple} and
-\helpref{wxDataObjectComposite}{wxdataobjectcomposite}.
+which derive from wxDataObject: \helpref{wxDataObjectSimple}{wxdataobjectsimple} and
+\helpref{wxDataObjectComposite}{wxdataobjectcomposite}.
\helpref{wxDataObjectSimple}{wxdataobjectsimple} is
the simplest wxDataObject possible and only holds data in a single format (such
as HTML or text) and \helpref{wxDataObjectComposite}{wxdataobjectcomposite} is
one as soon as you want to transfer data via the clipboard or drag and drop):
\begin{twocollist}\itemsep=1cm
-\twocolitem{{\bf 0. Use one of built-in classes}}{You may use wxTextDataObject,
+\twocolitem{{\bf 1. Use one of the built-in classes}}{You may use wxTextDataObject,
wxBitmapDataObject or wxFileDataObject in the simplest cases when you only need
to support one format and your data is either text, bitmap or list of files.}
-\twocolitem{{\bf 1. Use wxDataObjectSimple}}{Deriving from wxDataObjectSimple is the simplest
+\twocolitem{{\bf 2. Use wxDataObjectSimple}}{Deriving from wxDataObjectSimple is the simplest
solution for custom data - you will only support one format and so probably
won't be able to communicate with other programs, but data transfer will work
in your program (or between different copies of it).}
-\twocolitem{{\bf 2. Use wxDataObjectComposite}}{This is a simple but powerful
+\twocolitem{{\bf 3. Use wxDataObjectComposite}}{This is a simple but powerful
solution which allows you to support any number of formats (either
standard or custom if you combine it with the previous solution).}
-\twocolitem{{\bf 3. Use wxDataObject directly}}{This is the solution for
-maximal flexibility and efficiency, but it also is the most difficult to
+\twocolitem{{\bf 4. Use wxDataObject directly}}{This is the solution for
+maximal flexibility and efficiency, but it is also is the most difficult to
implement.}
\end{twocollist}
Please note that the easiest way to use drag and drop and the clipboard with
multiple formats is by using wxDataObjectComposite, but it is not the most
efficient one as each wxDataObjectSimple would contain the whole data in its
-respective formars. Now imagine that you want to paste 200 pages of text in
+respective formats. Now imagine that you want to paste 200 pages of text in
your proprietary format, as well as Word, RTF, HTML, Unicode and plain text to
the clipboard and even today's computers are in trouble. For this case, you
will have to derive from wxDataObject directly and make it enumerate its
formats and provide the data in the requested format on demand.
Note that neither the GTK data transfer mechanisms for the clipboard and
-drag and drop, neither does the OLE data transfer copy any data until another application
+drag and drop, nor the OLE data transfer copy any data until another application
actually requests the data. This is in contrast to the 'feel' offered to the
user of a program who would normally think that the data resides in the
clipboard after having pressed 'Copy' - in reality it is only declared to be
available.
There are several predefined data object classes derived from
-wxDataObjectSimple: \helpref{wxFileDataObject}{wxfiledataobject},
-\helpref{wxTextDataObject}{wxtextdataobject} and
+wxDataObjectSimple: \helpref{wxFileDataObject}{wxfiledataobject},
+\helpref{wxTextDataObject}{wxtextdataobject} and
\helpref{wxBitmapDataObject}{wxbitmapdataobject} which can be used without
change.
and from the clipboard and for drag and drop). Note that the format string
translation under Windows is not yet finished.
-\pythonnote{At this time this class is directly usable from wxPython.
-Derive a class from \helpref{wxPyDataObjectSimple}{wxdataobjectsimple}
+\pythonnote{At this time this class is not directly usable from wxPython.
+Derive a class from \helpref{wxPyDataObjectSimple}{wxdataobjectsimple}
instead.}
+\perlnote{This class is not currently usable from wxPerl; you may
+use \helpref{Wx::PlDataObjectSimple}{wxdataobjectsimple} instead.}
+
\wxheading{Virtual functions to override}
Each class derived directly from wxDataObject must override and implement all
of its functions which are pure virtual in the base class.
The data objects which only render their data or only set it (i.e. work in
-only one direction), should return 0 from
+only one direction), should return 0 from
\helpref{GetFormatCount}{wxdataobjectgetformatcount}.
\wxheading{Derived from}
\constfunc{virtual void}{GetAllFormats}{ \param{wxDataFormat *}{formats}, \param{Direction}{ dir = Get}}
-Copy all supported formats in the given direction to the array pointed to by
+Copy all supported formats in the given direction to the array pointed to by
{\it formats}. There is enough space for GetFormatCount(dir) formats in it.
+\perlnote{In wxPerl this method only takes the {\tt dir} parameter.
+In scalar context it returns the first format,
+in list context it returns a list containing all the supported formats.}
+
\membersection{wxDataObject::GetDataHere}\label{wxdataobjectgetdatahere}
\constfunc{virtual bool}{GetDataHere}{\param{const wxDataFormat\&}{ format}, \param{void }{*buf} }
The method will write the data of the format {\it format} in the buffer {\it
-buf} and return TRUE on success, FALSE on failure.
+buf} and return true on success, false on failure.
\membersection{wxDataObject::GetDataSize}\label{wxdataobjectgetdatasize}
Set the data in the format {\it format} of the length {\it len} provided in the
buffer {\it buf}.
-Returns TRUE on success, FALSE on failure.
+Returns true on success, false on failure.