2 // ArrangedElementCollection.cs
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 // Copyright (c) 2006 Jonathan Pobst
26 // Jonathan Pobst (monkey@jpobst.com)
30 using System
.Collections
;
32 namespace System
.Windows
.Forms
.Layout
34 public class ArrangedElementCollection
: IList
, ICollection
, IEnumerable
36 internal ArrayList list
;
38 internal ArrangedElementCollection ()
40 this.list
= new ArrayList ();
43 #region Public Properties
44 public virtual int Count { get { return list.Count; }
}
45 public virtual bool IsReadOnly { get { return list.IsReadOnly; }
}
48 #region Public Methods
49 public void CopyTo (Array array
, int index
)
51 list
.CopyTo (array
, index
);
54 public override bool Equals (object obj
)
56 if (obj
is ArrangedElementCollection
&& this == obj
)
62 public virtual IEnumerator
GetEnumerator ()
64 return list
.GetEnumerator ();
67 public override int GetHashCode ()
69 return base.GetHashCode ();
74 int IList
.Add (object value)
79 internal int Add (object value)
81 return list
.Add (value);
89 internal void Clear ()
94 bool IList
.Contains (object value)
96 return Contains (value);
99 internal bool Contains (object value)
101 return list
.Contains (value);
104 int IList
.IndexOf (object value)
106 return IndexOf (value);
109 internal int IndexOf (object value)
111 return list
.IndexOf (value);
114 void IList
.Insert (int index
, object value)
116 throw new NotSupportedException ();
119 internal void Insert (int index
, object value)
121 list
.Insert (index
, value);
124 bool IList
.IsFixedSize
{
125 get { return this.IsFixedSize; }
128 internal bool IsFixedSize
{
129 get { return list.IsFixedSize; }
132 void IList
.Remove (object value)
137 internal void Remove (object value)
142 void IList
.RemoveAt (int index
)
144 list
.RemoveAt (index
);
147 internal void InternalRemoveAt (int index
)
149 list
.RemoveAt (index
);
152 object IList
.this[int index
] {
153 get { return this[index]; }
154 set { this[index] = value; }
157 internal object this[int index
] {
158 get { return list[index]; }
159 set { list[index] = value; }
163 #region ICollection Members
164 bool ICollection
.IsSynchronized
{
165 get { return list.IsSynchronized; }
168 object ICollection
.SyncRoot
{
169 get { return list.IsSynchronized; }