1999-01-13 09:23:31 -05:00
|
|
|
\section{\class{wxDropTarget}}\label{wxdroptarget}
|
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
This class represents a target for a drag and drop operation. A \helpref{wxDataObject}{wxdataobject}
|
|
|
|
can be associated with it and by default, this object will be filled with the data from the
|
|
|
|
drag source, if the data formats supported by the data object match the drag source data
|
|
|
|
format.
|
|
|
|
|
|
|
|
There are various virtual handler functions defined in this class which may be overridden
|
|
|
|
to give visual feedback or react in a more fine-tuned way, e.g. by not accepting data on
|
|
|
|
the whole window area, but only a small portion of it. The normal sequence of calls is
|
|
|
|
\helpref{OnEnter}{wxdroptargetonenter}, possibly many times \helpref{OnDragOver}{wxdroptargetondragover},
|
|
|
|
\helpref{OnDrop}{wxdroptargetondrop} and finally \helpref{OnData}{wxdroptargetondata}.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
See \helpref{Drag and drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview}
|
1999-12-29 06:52:51 -05:00
|
|
|
for more information.
|
|
|
|
|
1999-01-13 09:23:31 -05:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
None
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/dnd.h>
|
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
\wxheading{Types}
|
|
|
|
|
|
|
|
\index{wxDragResult}wxDragResult is defined as follows:
|
|
|
|
|
2000-03-14 19:21:49 -05:00
|
|
|
\begin{verbatim}
|
1999-12-29 04:48:10 -05:00
|
|
|
enum wxDragResult
|
|
|
|
{
|
|
|
|
wxDragError, // error prevented the d&d operation from completing
|
|
|
|
wxDragNone, // drag target didn't accept the data
|
|
|
|
wxDragCopy, // the data was successfully copied
|
|
|
|
wxDragMove, // the data was successfully moved
|
|
|
|
wxDragCancel // the operation was cancelled by user (not an error)
|
|
|
|
};
|
|
|
|
\end{verbatim}
|
|
|
|
|
1999-01-13 09:23:31 -05:00
|
|
|
\wxheading{See also}
|
|
|
|
|
1999-12-29 06:52:51 -05:00
|
|
|
\helpref{wxDropSource}{wxdropsource},
|
1999-12-29 04:48:10 -05:00
|
|
|
\helpref{wxTextDropTarget}{wxtextdroptarget}, \helpref{wxFileDropTarget}{wxfiledroptarget},
|
|
|
|
\helpref{wxDataFormat}{wxdataformat}, \helpref{wxDataObject}{wxdataobject}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxDropTarget::wxDropTarget}\label{wxdroptargetwxdroptarget}
|
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
\func{}{wxDropTarget}{\param{wxDataObject*}{ data = NULL}}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
Constructor. {\it data} is the data to be associated with the drop target.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\membersection{wxDropTarget::\destruct{wxDropTarget}}\label{wxdroptargetdtor}
|
|
|
|
|
|
|
|
\func{}{\destruct{wxDropTarget}}{\void}
|
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
Destructor. Deletes the associated data object, if any.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
\membersection{wxDropTarget::GetData}\label{wxdroptargetgetdata}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
\func{virtual void}{GetData}{\void}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
This method may only be called from within \helpref{OnData}{wxdroptargetondata}.
|
|
|
|
By default, this method copies the data from the drop source to the
|
|
|
|
\helpref{wxDataObject}{wxdataobject} associated with this drop target,
|
|
|
|
calling its \helpref{wxDataObject::SetData}{wxdataobjectsetdata} method.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-11-02 09:04:44 -05:00
|
|
|
\membersection{wxDropTarget::OnData}\label{wxdroptargetondata}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-11-02 09:04:44 -05:00
|
|
|
\func{virtual wxDragResult}{OnData}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Called after \helpref{OnDrop}{wxdroptargetondrop} returns true. By default this
|
1999-12-29 04:48:10 -05:00
|
|
|
will usually \helpref{GetData}{wxdroptargetgetdata} and will return the suggested
|
|
|
|
default value {\it def}.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\membersection{wxDropTarget::OnDrop}\label{wxdroptargetondrop}
|
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
\func{virtual bool}{OnDrop}{\param{wxCoord }{x}, \param{wxCoord }{y}}
|
1999-01-13 09:23:31 -05:00
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Called when the user drops a data object on the target. Return false to veto the operation.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{x}{The x coordinate of the mouse.}
|
|
|
|
|
|
|
|
\docparam{y}{The y coordinate of the mouse.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Return true to accept the data, false to veto the operation.
|
1999-01-13 09:23:31 -05:00
|
|
|
|
1999-11-02 09:04:44 -05:00
|
|
|
\membersection{wxDropTarget::OnEnter}\label{wxdroptargetonenter}
|
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
\func{virtual wxDragResult}{OnEnter}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
|
|
|
|
|
|
|
|
Called when the mouse enters the drop target. By default, this calls \helpref{OnDragOver}{wxdroptargetondragover}.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{x}{The x coordinate of the mouse.}
|
|
|
|
|
|
|
|
\docparam{y}{The y coordinate of the mouse.}
|
|
|
|
|
|
|
|
\docparam{def}{Suggested default for return value. Determined by SHIFT or CONTROL key states.}
|
1999-11-02 09:04:44 -05:00
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
Returns the desired operation or {\tt wxDragNone}. This is used for optical feedback
|
|
|
|
from the side of the drop source, typically in form of changing the icon.
|
|
|
|
|
|
|
|
\membersection{wxDropTarget::OnDragOver}\label{wxdroptargetondragover}
|
|
|
|
|
|
|
|
\func{virtual wxDragResult}{OnDragOver}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
|
|
|
|
|
|
|
|
Called when the mouse is being dragged over the drop target. By default,
|
|
|
|
this calls functions return the suggested return value {\it def}.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{x}{The x coordinate of the mouse.}
|
|
|
|
|
|
|
|
\docparam{y}{The y coordinate of the mouse.}
|
|
|
|
|
|
|
|
\docparam{def}{Suggested value for return value. Determined by SHIFT or CONTROL key states.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
Returns the desired operation or {\tt wxDragNone}. This is used for optical feedback
|
|
|
|
from the side of the drop source, typically in form of changing the icon.
|
1999-11-02 09:04:44 -05:00
|
|
|
|
1999-01-13 09:23:31 -05:00
|
|
|
\membersection{wxDropTarget::OnLeave}\label{wxdroptargetonleave}
|
|
|
|
|
|
|
|
\func{virtual void}{OnLeave}{\void}
|
|
|
|
|
|
|
|
Called when the mouse leaves the drop target.
|
1999-01-17 14:25:06 -05:00
|
|
|
|
1999-12-29 04:48:10 -05:00
|
|
|
\membersection{wxDropTarget::SetDataObject}\label{wxdroptargetsetdataobject}
|
|
|
|
|
|
|
|
\func{void}{SetDataObject}{\param{wxDataObject*}{ data}}
|
|
|
|
|
|
|
|
Sets the data \helpref{wxDataObject}{wxdataobject} associated with the
|
|
|
|
drop target and deletes any previously associated data object.
|
2000-02-06 14:11:10 -05:00
|
|
|
|