wx.DropSource

Inheritance diagram for wx.DropSource:



Description

This class represents a source for a drag and drop operation.

The return values of most of the DnD operations, termed wx.DragResult, can be sketched as follows:

Flag Description
wx.DragError Error prevented the d&d operation from completing
wx.DragNone Drag target didn’t accept the data
wx.DragCopy The data was successfully copied
wx.DragMove The data was successfully moved (MSW only)
wx.DragLink Operation is a drag-link
``wx.DragCancel` The operation was cancelled by user (not an error)

Properties Summary

Class API

Methods

__init__(win, copy=wx.NullCursor, move=wx.NullCursor, none=wx.NullCursor)

Constructor for wx.DropSource.

Parameters:


Returns:

wx.DropSource


DoDragDrop(flags=wx.Drag_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 (int): If wx.Drag_AllowMove is included in the flags, data may be moved and not only copied (default). If wx.Drag_DefaultMove is specified (which includes the previous flag), this is even the default operation

Returns:

int


GetDataObject()

Returns the wx.DataObject object that has been assigned previously.


Returns:

wx.DataObject


GiveFeedback(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 (int): The effect to implement. One of wx.DragCopy, wx.DragMove, wx.DragLink and wx.DragNone.

Returns:

bool


SetCursor(res, cursor)

Set the icon to use for a certain drag result.

Parameters:

  • res (int): The drag result to set the icon for.
  • cursor (wx.Cursor): The icon to show when this drag result occurs.

SetData(data)

Sets the data wx.DataObject associated with the drop source. This will not delete any previously associated data.

Parameters:


Properties

DataObject
See GetDataObject and SetData