using System;
using System.Text;
using System.Windows.Forms;
namespace DevComponents.AdvTree
{
///
/// Defines the data for NodeDragFeedback event.
///
public class TreeDragFeedbackEventArgs : EventArgs
{
///
/// Gets or sets whether this drop location is accepted. Default value is true. You can set this to false to disable drop at this location.
///
public bool AllowDrop = true;
///
/// Gets or sets the parent node for the node that is being dragged. This can be null/nothing value to indicate a root top-level node that
/// is in AdvTree.Nodes collection.
///
public Node ParentNode = null;
///
/// Gets or sets the new insert position inside of ParentNode.Nodes collection for the node being dragged. If InsertPosition is -1
/// the ParentNode refers to the current mouse over node and drag & drop node will be added as child node to it.
///
public int InsertPosition = 0;
private Node _DragNode;
///
/// Gets reference to the node being dragged.
///
public Node DragNode
{
get { return _DragNode; }
#if FRAMEWORK20
set
{
_DragNode = value;
}
#endif
}
///
/// Initializes a new instance of the TreeDragFeedbackEventArgs class.
///
///
///
public TreeDragFeedbackEventArgs(Node parentNode, int insertPosition, Node dragNode)
{
ParentNode = parentNode;
InsertPosition = insertPosition;
_DragNode = dragNode;
}
///
/// Initializes a new instance of the TreeDragFeedbackEventArgs class.
///
///
///
public TreeDragFeedbackEventArgs(Node parentNode, int insertPosition, Node dragNode, DragDropEffects effect)
{
ParentNode = parentNode;
InsertPosition = insertPosition;
_DragNode = dragNode;
_Effect = effect;
}
///
/// Initializes a new instance of the TreeDragFeedbackEventArgs class.
///
public TreeDragFeedbackEventArgs()
{
}
internal bool EffectSet = false;
private DragDropEffects _Effect = DragDropEffects.None;
///
/// Gets or sets the drop effect for the drag-drop operation.
///
public DragDropEffects Effect
{
get { return _Effect; }
set
{
_Effect = value;
EffectSet = true;
}
}
}
public class MultiNodeTreeDragFeedbackEventArgs : TreeDragFeedbackEventArgs
{
///
/// Initializes a new instance of the TreeDragFeedbackEventArgs class.
///
///
///
public MultiNodeTreeDragFeedbackEventArgs(Node parentNode, int insertPosition, Node[] dragNodes) :
base(parentNode, insertPosition, dragNodes[0])
{
_DragNodes = dragNodes;
}
///
/// Initializes a new instance of the TreeDragFeedbackEventArgs class.
///
///
///
public MultiNodeTreeDragFeedbackEventArgs(Node parentNode, int insertPosition, Node[] dragNodes, DragDropEffects effect) :
base(parentNode, insertPosition, dragNodes[0], effect)
{
_DragNodes = dragNodes;
}
private Node[] _DragNodes;
///
/// Gets reference to the node being dragged.
///
public Node[] DragNodes
{
get { return _DragNodes; }
#if FRAMEWORK20
set
{
_DragNodes = value;
}
#endif
}
}
}