Package wx :: Package lib :: Package mixins :: Module treemixin :: Class DragAndDrop
[frames | no frames]

Type DragAndDrop

       object --+    
                |    
TreeAPIHarmonizer --+
                    |
       object --+   |
                |   |
       TreeHelper --+
                    |
                   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):
    ...

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 Summary
  __init__(self, *args, **kwargs)
  IsValidDragItem(self, dragItem)
  IsValidDropTarget(self, dropTarget)
  OnBeginDrag(self, event)
  OnDragging(self, event)
  OnDrop(self, dropItem, dragItem)
This function must be overloaded in the derived class.
  OnEndDrag(self, event)
  ResetCursor(self)
  SetCursorToDragging(self)
  SetCursorToDroppingImpossible(self)
  StartDragging(self)
  StopDragging(self)

Method Details

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.


Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:54:54 2009 http://epydoc.sf.net