This class represents a target for a drag and drop operation. A 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 OnEnter, possibly many times OnDragOver, OnDrop and finally OnData.
See Drag and drop overview and wxDataObject overview for more information.
Derived from
None
Include files
<wx/dnd.h>
Types
wxDragResult is defined as follows:
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)
};
See alsowxDropSource, wxTextDropTarget, wxFileDropTarget, wxDataFormat, wxDataObject
Members
wxDropTarget::wxDropTarget
wxDropTarget::~wxDropTarget
wxDropTarget::GetData
wxDropTarget::OnData
wxDropTarget::OnDrop
wxDropTarget::OnEnter
wxDropTarget::OnDragOver
wxDropTarget::OnLeave
wxDropTarget::SetDataObject
wxDropTarget(wxDataObject* data = NULL)
Constructor. data is the data to be associated with the drop target.
~wxDropTarget()
Destructor. Deletes the associated data object, if any.
virtual void GetData()
This method may only be called from within OnData. By default, this method copies the data from the drop source to the wxDataObject associated with this drop target, calling its wxDataObject::SetData method.
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
Called after OnDrop returns TRUE. By default this will usually GetData and will return the suggested default value def.
virtual bool OnDrop(wxCoord x, wxCoord E ./usr/share/doc/wxwin2.4-doc/wxWindows-manual.html/wxwin124.html 0000644 0000000 0000000 00000007064 10246312305 023257 0 ustar root root
This class is used for drop files events, that is, when files have been dropped onto the window. This functionality is currently only available under Windows. The window must have previously been enabled for dropping by calling wxWindow::DragAcceptFiles.
Important note: this is a separate implementation to the more general drag and drop implementation documented here. It uses the older, Windows message-based approach of dropping files.
Derived from
Include files
<wx/event.h>
Event table macros
To process a drop files event, use these event handler macros to direct input to a member function that takes a wxDropFilesEvent argument.
| EVT_DROP_FILES(func) | Process a wxEVT_DROP_FILES event. |
Members