.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2018 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 <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;"> <img id="toggleBlock-trigger" src="_static/images/closed.png"/> Inheritance diagram for class <strong>DragAndDrop</strong>: </div> <div id="toggleBlock-summary" style="display:block;"></div> <div id="toggleBlock-content" style="display:none;"> <p class="graphviz"> <center><img src="_static/images/inheritance/wx.lib.mixins.treemixin.DragAndDrop_inheritance.png" alt="Inheritance diagram of DragAndDrop" usemap="#dummy" class="inheritance"/></center> <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script> <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.mixins.treemixin.DragAndDrop.html" title="This is a mixin class that can be used to easily implement" alt="" coords="177,83,449,112"/> <area shape="rect" id="node2" href="wx.lib.mixins.treemixin.TreeAPIHarmonizer.html" title="This class attempts to hide the differences in API between the" alt="" coords="5,5,315,35"/> <area shape="rect" id="node3" href="wx.lib.mixins.treemixin.TreeHelper.html" title="This class provides methods that are not part of the API of any" alt="" coords="339,5,594,35"/> </map> </p> </div> | |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)