Contents Up Previous Next

wxDropTarget

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 also

wxDropSource, wxTextDropTarget, wxFileDropTarget, wxDataFormat, wxDataObject

Members

wxDropTarget::wxDropTarget
wxDropTarget::~wxDropTarget
wxDropTarget::GetData
wxDropTarget::OnData
wxDropTarget::OnDrop
wxDropTarget::OnEnter
wxDropTarget::OnDragOver
wxDropTarget::OnLeave
wxDropTarget::SetDataObject


wxDropTarget::wxDropTarget

wxDropTarget(wxDataObject* data = NULL)

Constructor. data is the data to be associated with the drop target.


wxDropTarget::~wxDropTarget

~wxDropTarget()

Destructor. Deletes the associated data object, if any.


wxDropTarget::GetData

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.


wxDropTarget::OnData

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.


wxDropTarget::OnDrop

virtual bool OnDrop(wxCoord x, wxCoord E./usr/share/doc/wxwin2.4-doc/wxWindows-manual.html/wxwin124.html0000644000000000000000000000706410246312305023257 0ustar rootroot wxDropFilesEvent

Contents Up Previous Next

wxDropFilesEvent

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

wxEvent
wxObject

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.
See also

Event handling overview

Members

wxDropFilesEvent::wxDropFilesEvent