1999-01-13 09:23:31 -05:00
|
|
|
\section{\class{wxBitmapDataObject}}\label{wxbitmapdataobject}
|
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
wxBitmapDataObject is a specialization of wxDataObject for bitmap data. It can be
|
|
|
|
used without change to paste data into the \helpref{wxClipboard}{wxclipboard}
|
|
|
|
or a \helpref{wxDropSource}{wxdropsource}. A user may wish to derive a new class
|
|
|
|
from this class for providing a bitmap on-demand in order to minimize memory consumption
|
|
|
|
when offering data in several formats, such as a bitmap and GIF.
|
|
|
|
|
|
|
|
In order to offer bitmap data on-demand \helpref{GetSize}{wxbitmapdataobjectgetsize}
|
|
|
|
and \helpref{WriteData}{wxbitmapdataobjectwritedata} will have to be overridden.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\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}
|
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
\helpref{wxDataObject}{wxdataobject}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxBitmapDataObject::wxBitmapDataObject}\label{wxbitmapdataobjectwxbitmapdataobject}
|
|
|
|
|
|
|
|
\func{}{wxBitmapDataObject}{\void}
|
|
|
|
|
1999-01-31 06:42:58 -05:00
|
|
|
Default constructor. Call \helpref{SetBitmap}{wxbitmapdataobjectsetbitmap} later
|
1999-01-30 10:58:31 -05:00
|
|
|
or override \helpref{WriteData}{wxbitmapdataobjectwritedata} and
|
|
|
|
\helpref{GetSize}{wxbitmapdataobjectgetsize} for providing data on-demand.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
\func{}{wxBitmapDataObject}{\param{const wxBitmap\& }{bitmap}}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
Constructor, passing a bitmap.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
\membersection{wxBitmapDataObject::GetSize}\label{wxbitmapdataobjectgetsize}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
\constfunc{virtual size\_t}{GetSize}{\void}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
Returns the data size. By default, returns the size of the bitmap data
|
1999-01-31 06:42:58 -05:00
|
|
|
set in the constructor or using \helpref{SetBitmap}{wxbitmapdataobjectsetbitmap}.
|
1999-01-30 10:58:31 -05:00
|
|
|
This can be overridden to provide size data on-demand. Note that you'd
|
|
|
|
have to call the inherited GetSize method as this is the only way
|
|
|
|
to get to know the transfer size of the bitmap in a platform dependent
|
|
|
|
way - a bitmap has different size under GTK and Windows. In practice,
|
|
|
|
this would look like this:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
size_t MyBitmapDataObject::GetSize()
|
|
|
|
{
|
|
|
|
// Get bitmap from global container. This container
|
|
|
|
// should be able to "produce" data in all formats
|
|
|
|
// offered by the application but store it only in
|
|
|
|
// one format to reduce memory consumption.
|
|
|
|
|
|
|
|
wxBitmap my_bitmap = my_global_container->GetBitmap();
|
|
|
|
|
|
|
|
// temporarily set bitmap
|
|
|
|
|
|
|
|
SetBitmap( my_bitmap );
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
size_t ret = wxBitmapDataObject::GetSize();
|
|
|
|
|
|
|
|
// unset bitmap again
|
|
|
|
|
|
|
|
SetBitmap( wxNullBitmap );
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
retrun ret;
|
|
|
|
}
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
TODO: Offer a nicer way to do this. Maybe by providing a platform
|
|
|
|
dependent function in this class like
|
1999-02-09 16:22:58 -05:00
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
\begin{verbatim}
|
|
|
|
size_t GetBitmapSize( const wxBitmap &bitmap )
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
|
|
\membersection{wxBitmapDataObject::GetBitmap}\label{wxbitmapdataobjectgettext}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\constfunc{virtual wxBitmap}{GetBitmap}{\void}
|
|
|
|
|
1999-01-30 10:58:31 -05:00
|
|
|
Returns the bitmap 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 bitmap form from
|
|
|
|
the \helpref{wxClipboard}{wxclipboard}.
|
|
|
|
|
1999-01-31 06:42:58 -05:00
|
|
|
\membersection{wxBitmapDataObject::SetBitmap}\label{wxbitmapdataobjectsetbitmap}
|
1999-01-30 10:58:31 -05:00
|
|
|
|
|
|
|
\func{virtual void}{SetBitmap}{\param{const wxBitmap\& }{bitmap}}
|
|
|
|
|
|
|
|
Sets the bitmap associated with the data object. This method is called
|
|
|
|
internally when retrieving data from the \helpref{wxClipboard}{wxclipboard}
|
|
|
|
and may be used to paste data to the clipboard directly (instead of
|
|
|
|
on-demand).
|
|
|
|
|
|
|
|
\membersection{wxBitmapDataObject::WriteData}\label{wxbitmapdataobjectwritedata}
|
|
|
|
|
|
|
|
\constfunc{virtual void}{WriteData}{\param{void}{*dest} }
|
|
|
|
|
|
|
|
Write the data owned by this class to {\it dest}. By default, this
|
|
|
|
calls \helpref{WriteBitmap}{wxbitmapdataobjectwritebitmap} with the bitmap
|
|
|
|
set in the constructor or using \helpref{SetBitmap}{wxbitmapdataobjectsetbitmap}.
|
|
|
|
This can be overridden to provide bitmap data on-demand; in this case
|
|
|
|
\helpref{WriteBitmap}{wxbitmapdataobjectwritebitmap} must be called from
|
|
|
|
within th overriding WriteData() method.
|
|
|
|
|
|
|
|
\membersection{wxBitmapDataObject::WriteBitmap}\label{wxbitmapdataobjectwritebitmap}
|
|
|
|
|
|
|
|
\constfunc{void}{WriteBitmap}{\param{const wxBitmap\& }{bitmap}\param{void}{*dest} }
|
|
|
|
|
|
|
|
Writes the the bitmap {\it bitmap} to {\it dest}. This method must be called
|
|
|
|
from \helpref{WriteData}{wxbitmapdataobjectwritedata}.
|
1999-01-13 09:23:31 -05:00
|
|
|
|