.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.mixins.treemixin .. highlight:: python .. _wx.lib.mixins.treemixin.DragAndDrop: ========================================================================================================================================== |phoenix_title| **wx.lib.mixins.treemixin.DragAndDrop** ========================================================================================================================================== This is a mixin class that can be used to easily implement dragging and dropping of tree items. It can be mixed in with wx.TreeCtrl, wx.gizmos.TreeListCtrl, or wx.lib.customtree.CustomTreeCtrl. To use it derive a new class from this class and one of the tree controls, e.g.:: class MyTree(DragAndDrop, wx.TreeCtrl): # Other code here You *must* implement OnDrop. OnDrop is called when the user has dropped an item on top of another item. It's up to you to decide how to handle the drop. If you are using this mixin together with the VirtualTree mixin, it makes sense to rearrange your underlying data and then call RefreshItems to let the virtual tree refresh itself. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class DragAndDrop:
| |super_classes| Known Superclasses ================================== :class:`wx.lib.mixins.treemixin.TreeAPIHarmonizer`, :class:`wx.lib.mixins.treemixin.TreeHelper` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.mixins.treemixin.DragAndDrop.__init__` Initialize self. See help(type(self)) for accurate signature. :meth:`~wx.lib.mixins.treemixin.DragAndDrop.IsValidDragItem` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.IsValidDropTarget` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.OnBeginDrag` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.OnDragging` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.OnDrop` This function must be overloaded in the derived class. :meth:`~wx.lib.mixins.treemixin.DragAndDrop.OnEndDrag` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.ResetCursor` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.SetCursorToDragging` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.SetCursorToDroppingImpossible` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.StartDragging` :meth:`~wx.lib.mixins.treemixin.DragAndDrop.StopDragging` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: DragAndDrop(TreeAPIHarmonizer, TreeHelper) This is a mixin class that can be used to easily implement dragging and dropping of tree items. It can be mixed in with wx.TreeCtrl, wx.gizmos.TreeListCtrl, or wx.lib.customtree.CustomTreeCtrl. To use it derive a new class from this class and one of the tree controls, e.g.:: class MyTree(DragAndDrop, wx.TreeCtrl): # Other code here You *must* implement OnDrop. OnDrop is called when the user has dropped an item on top of another item. It's up to you to decide how to handle the drop. If you are using this mixin together with the VirtualTree mixin, it makes sense to rearrange your underlying data and then call RefreshItems to let the virtual tree refresh itself. .. method:: __init__(self, \*args, \*\*kwargs) Initialize self. See help(type(self)) for accurate signature. .. method:: IsValidDragItem(self, dragItem) .. method:: IsValidDropTarget(self, dropTarget) .. method:: OnBeginDrag(self, event) .. method:: OnDragging(self, event) .. method:: OnDrop(self, dropItem, dragItem) This function must be overloaded in the derived class. dragItem is the item being dragged by the user. dropItem is the item dragItem is dropped upon. If the user doesn't drop dragItem on another item, dropItem equals the (hidden) root item of the tree control. .. method:: OnEndDrag(self, event) .. method:: ResetCursor(self) .. method:: SetCursorToDragging(self) .. method:: SetCursorToDroppingImpossible(self) .. method:: StartDragging(self) .. method:: StopDragging(self)