$szTitle = "wxdropsource"; include "./_header.inc"; ?>
this class represents a source for a drag and drop operation.
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
wxdroptarget, wxtextdroptarget, wxfiledroptarget
members
wxdropsource::wxdropsource
wxdropsource::~wxdropsource
wxdropsource::setdata
wxdropsource::dodragdrop
wxdropsource::getdataobject
wxdropsource::givefeedback
wxdropsource::setcursor
wxdropsource(wxwindow* win = null,const wxiconorcursor& iconcopy = wxnulliconorcursor, const wxiconorcursor& iconmove = wxnulliconorcursor, const wxiconorcursor& iconnone = wxnulliconorcursor)
wxdropsource(wxdataobject& data, wxwindow* win = null,const wxiconorcursor& iconcopy = wxnulliconorcursor, const wxiconorcursor& iconmove = wxnulliconorcursor, const wxiconorcursor& iconnone = wxnulliconorcursor)
the constructors for wxdataobject.
if you use the constructor without data parameter you must call setdata later.
note that the exact type of iconcopy and subsequent parameters differs between wxmsw and wxgtk: these are cursors under windows but icons for gtk. you should use the macro wxdrop_icon in portable programs instead of directly using either of these types.
parameters
win
iconcopy
iconmove
iconnone
win is the window which initiates the drag and drop operation.
virtual ~wxdropsource()
void setdata(wxdataobject& data)
sets the data wxdataobject associated with the drop source. this will not delete any previously associated data.
virtual wxdragresult dodragdrop(int flags = wxdrag_copyonly)
do it (call this in response to a mouse button press, for example). this starts the drag-and-drop operation which will terminate when the user releases the mouse.
parameters
flags
return value
returns the operation requested by the user, may be wxdragcopy, wxdragmove, wxdraglink, wxdragcancel or wxdragnone if an error occurred.
wxdataobject * getdataobject()
returns the wxdataobject object that has been assigned previously.
virtual bool givefeedback(wxdragresult effect)
overridable: you may give some custom ui feedback during the drag and drop operation in this function. it is called on each mouse move, so your implementation must not be too slow.
parameters
effect
scrolling
return value
return false if you want default feedback, or true if you implement your own feedback. the return values is ignored under gtk.
void setcursor(wxdragresult res, const wxcursor& cursor)
set the icon to use for a certain drag result.
parameters
res
cursor
include "./_footer.inc"; ?>