| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- //
- // System.Windows.Forms.TreeNodeCollection
- //
- // Author:
- // stubbed out by Jackson Harper ([email protected])
- // Dennis Hayes ([email protected])
- // Aleksey Ryabchuk ([email protected])
- //
- // (C) 2002 Ximian, Inc
- //
- using System.Collections;
- namespace System.Windows.Forms {
- // <summary>
- //
- // </summary>
- public class TreeNodeCollection : IList, ICollection, IEnumerable {
- private TreeNode owner;
- private ArrayList list;
- private TreeView treeView;
- internal TreeNodeCollection ( TreeNode owner, TreeView treeView )
- {
- list = new ArrayList();
- this.owner = owner;
- this.treeView = treeView;
- }
-
- public int Count {
- get { return list.Count; }
- }
- public bool IsReadOnly {
- get { return list.IsReadOnly; }
- }
- [MonoTODO]
- public virtual TreeNode this[int index] {
- get {
- return (TreeNode) list[index];
- }
- set {
- list[index] = value;
- }
- }
-
- public virtual TreeNode Add( string text )
- {
- TreeNode node = new TreeNode ( text );
- Add ( node );
- return node;
- }
- [MonoTODO]
- public virtual int Add( TreeNode node )
- {
- if ( node == null )
- throw new ArgumentNullException("value");
- if ( node.Parent != null )
- throw new ArgumentException("Object already has a parent.", "node");
- node.setParent( owner );
- node.setTreeView ( treeView );
- int index = list.Add( node );
- return index;
- }
- public virtual void AddRange( TreeNode[] nodes )
- {
- if ( nodes == null )
- throw new ArgumentNullException("nodes");
- foreach ( TreeNode node in nodes ) {
- // it will do a check for parent and set the parent
- Add ( node );
- }
- }
- [MonoTODO]
- public virtual void Clear()
- {
- foreach ( object node in list )
- ( ( TreeNode )node ).setParent ( null );
- list.Clear();
- }
- public bool Contains( TreeNode node )
- {
- return list.Contains( node );
- }
- [MonoTODO]
- public void CopyTo(Array dest, int index)
- {
- //FIXME:
- }
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator();
- }
- public int IndexOf( TreeNode node )
- {
- return list.IndexOf( node );
- }
- [MonoTODO]
- public virtual void Insert( int index, TreeNode node )
- {
- if ( node == null )
- throw new ArgumentNullException ( "node" );
- if ( node.Parent != null)
- throw new ArgumentException ( "Object already has a parent.", "node" );
- if (index < 0 || index > Count )
- throw new ArgumentOutOfRangeException( "index" );
- list.Insert( index, node );
- node.setParent ( owner );
- }
- [MonoTODO]
- public void Remove( TreeNode node )
- {
- if ( node == null )
- throw new ArgumentNullException( "node" );
- list.Remove( node );
- node.setParent ( null );
- }
- [MonoTODO]
- public virtual void RemoveAt( int index )
- {
- if (index < 0 || index > Count )
- throw new ArgumentOutOfRangeException( "index" );
- TreeNode node = (TreeNode) list[ index ];
- list.RemoveAt( index );
- node.setParent ( null );
- }
- /// <summary>
- /// IList Interface implmentation.
- /// </summary>
- bool IList.IsReadOnly{
- get{
- // We allow addition, removeal, and editing of items after creation of the list.
- return false;
- }
- }
- bool IList.IsFixedSize{
- get{
- // We allow addition and removeal of items after creation of the list.
- return false;
- }
- }
- //[MonoTODO]
- object IList.this[int index]{
- get{
- throw new NotImplementedException ();
- }
- set{
- //FIXME:
- }
- }
-
- [MonoTODO]
- void IList.Clear(){
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- int IList.Add( object value){
- throw new NotImplementedException ();
- }
- [MonoTODO]
- bool IList.Contains( object value){
- throw new NotImplementedException ();
- }
- [MonoTODO]
- int IList.IndexOf( object value){
- throw new NotImplementedException ();
- }
- [MonoTODO]
- void IList.Insert(int index, object value){
- //FIXME:
- }
- [MonoTODO]
- void IList.Remove( object value){
- //FIXME:
- }
- [MonoTODO]
- void IList.RemoveAt( int index){
- //FIXME:
- }
- // End of IList interface
- /// <summary>
- /// ICollection Interface implmentation.
- /// </summary>
- int ICollection.Count{
- get{
- throw new NotImplementedException ();
- }
- }
- bool ICollection.IsSynchronized{
- get{
- throw new NotImplementedException ();
- }
- }
- object ICollection.SyncRoot{
- get{
- throw new NotImplementedException ();
- }
- }
- void ICollection.CopyTo(Array array, int index){
- //FIXME:
- }
- // End Of ICollection
- }
- }
|