wxdroptargetthis 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 (msw only) wxdraglink, // operation is a drag-link wxdragcancel // the operation was cancelled by user (not an error) };see also wxdropsource, wxtextdroptarget, wxfiledroptarget, wxdataformat, wxdataobject members
wxdroptarget::wxdroptarget
wxdroptarget::wxdroptargetwxdroptarget(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::getdatavirtual 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::ondatavirtual 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::ondropvirtual bool ondrop(wxcoord x, wxcoord y) called when the user drops a data object on the target. return false to veto the operation. parameters x
y
return value return true to accept the data, false to veto the operation.
wxdroptarget::onentervirtual wxdragresult onenter(wxcoord x, wxcoord y, wxdragresult def) called when the mouse enters the drop target. by default, this calls ondragover. parameters x
y
def
return value returns the desired operation or wxdragnone. this is used for optical feedback from the side of the drop source, typically in form of changing the icon.
wxdroptarget::ondragovervirtual wxdragresult ondragover(wxcoord x, wxcoord y, wxdragresult def) called when the mouse is being dragged over the drop target. by default, this calls functions return the suggested return value def. parameters x
y
def
return value returns the desired operation or wxdragnone. this is used for optical feedback from the side of the drop source, typically in form of changing the icon.
wxdroptarget::onleavevirtual void onleave() called when the mouse leaves the drop target.
wxdroptarget::setdataobjectvoid setdataobject(wxdataobject* data) sets the data wxdataobject associated with the drop target and deletes any previously associated data object.
|