using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
namespace DevComponents.Tree
{
///
/// Represents collection of connector points for a node.
///
public class ConnectorPointsCollection:CollectionBase
{
#region Private Variables
private Node m_ParentNode=null;
#endregion
#region Internal Implementation
///
/// Default constructor.
///
public ConnectorPointsCollection()
{
}
///
/// Gets or sets the node this collection is associated with.
///
[Browsable(false),DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Node ParentNode
{
get {return m_ParentNode;}
}
///
/// Sets the node collection belongs to.
///
/// Node that is parent of this collection.
internal void SetParentNode(Node parent)
{
m_ParentNode=parent;
}
///
/// Adds new object to the collection.
///
/// Object to add.
/// Index of newly added object.
public int Add(Point p)
{
return List.Add(p);
}
///
/// Adds range of objects to the array.
///
/// Array to add.
public void AddRange(Point[] ap)
{
foreach(Point p in ap)
this.Add(p);
}
///
/// Copies objects of the collection to the array.
///
///
public Point[] ToArray()
{
Point[] ap=new Point[this.Count];
this.CopyTo(ap);
return ap;
}
///
/// Returns reference to the object in collection based on it's index.
///
public Point this[int index]
{
get {return (Point)(List[index]);}
set {List[index] = value;}
}
///
/// Inserts new object into the collection.
///
/// Position of the object.
/// Object to insert.
public void Insert(int index, Point value)
{
List.Insert(index, value);
}
///
/// Returns index of the object inside of the collection.
///
/// Reference to the object.
/// Index of the object.
public int IndexOf(Point value)
{
return List.IndexOf(value);
}
///
/// Returns whether collection contains specified object.
///
/// Object to look for.
/// true if object is part of the collection, otherwise false.
public bool Contains(Point value)
{
return List.Contains(value);
}
///
/// Removes specified object from the collection.
///
///
public void Remove(Point value)
{
List.Remove(value);
}
protected override void OnRemoveComplete(int index,object value)
{
base.OnRemoveComplete(index,value);
}
protected override void OnInsertComplete(int index,object value)
{
base.OnInsertComplete(index,value);
}
///
/// Copies collection into the specified array.
///
/// Array to copy collection to.
/// Starting index.
public void CopyTo(Point[] array, int index)
{
List.CopyTo(array, index);
}
///
/// Copies contained items to the ColumnHeader array.
///
/// Array to copy to.
internal void CopyTo(Point[] array)
{
List.CopyTo(array,0);
}
protected override void OnClear()
{
base.OnClear();
}
#endregion
}
}