Phoenix Logo

phoenix_title wx.DropSource

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


class_hierarchy Class Hierarchy

Inheritance diagram for class DropSource:


method_summary Methods Summary

__init__ This constructor requires that you must call SetData later.
DoDragDrop Starts the drag-and-drop operation which will terminate when the user releases the mouse.
GetDataObject Returns the wx.DataObject object that has been assigned previously.
GiveFeedback You may give some custom UI feedback during the drag and drop operation by overriding this function.
SetCursor Set the icon to use for a certain drag result.
SetData Sets the data wx.DataObject associated with the drop source.
SetIcon Set the icon to use for a certain drag result.

property_summary Properties Summary

DataObject See GetDataObject

api Class API



class wx.DropSource(object)

Possible constructors:

DropSource(win=None)

DropSource(data, win=None)

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


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, win=None)

This constructor requires that you must call SetData later.

Note that the type of iconCopy and subsequent parameters differs between different ports: these are cursors under Windows and OS X but icons for GTK. You should use the macro DROP_ICON in portable programs instead of directly using either of these types.

Parameters:win (wx.Window) – The window which initiates the drag and drop operation.

Availability

Only available for MSW, OSX.



__init__ (self, data, win=None)

The constructor taking a wx.DataObject.

Note that the type of iconCopy and subsequent parameters differs between different ports: these are cursors under Windows and OS X but icons for GTK. You should use the macro DROP_ICON in portable programs instead of directly using either of these types.

Parameters:
  • data (wx.DataObject) – The data associated with the drop source.
  • win (wx.Window) – The window which initiates the drag and drop operation.

Availability

Only available for MSW, OSX.





DoDragDrop(self, flags=Drag_CopyOnly)

Starts the drag-and-drop operation which will terminate when the user releases the mouse.

Call this in response to a mouse button press, for example.

Parameters:flags (int) – If wx.Drag_AllowMove is included in the flags, data may be moved and not only copied as is the case for the default wx.Drag_CopyOnly . If wx.Drag_DefaultMove is specified (which includes the previous flag), moving is not only possible but becomes the default operation.
Return type: wx.DragResult
Returns:The operation requested by the user, may be wx.DragCopy , wx.DragMove , wx.DragLink , wx.DragCancel or wx.DragNone if an error occurred.


GetDataObject(self)

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

Return type: wx.DataObject


GiveFeedback(self, effect)

You may give some custom UI feedback during the drag and drop operation by overriding this function.

It is called on each mouse move, so your implementation must not be too slow.

Parameters:effect (DragResult) – The effect to implement. One of wx.DragCopy , wx.DragMove , wx.DragLink and wx.DragNone .
Return type:bool
Returns:False if you want default feedback, or True if you implement your own feedback. The return value is ignored under GTK.


SetCursor(self, res, cursor)

Set the icon to use for a certain drag result.

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

MSW, OSX ports.

Availability

Only available for MSW, OSX.



SetData(self, data)

Sets the data wx.DataObject associated with the drop source.

This will not delete any previously associated data.

Parameters:data (wx.DataObject) –


SetIcon(self, res, icon)

Set the icon to use for a certain drag result.

Parameters:
  • res (DragResult) – The drag result to set the icon for.
  • icon (wx.Icon) – The icon to show when this drag result occurs.

GTK port.

Availability

Only available for GTK.


Properties



DataObject

See GetDataObject