* ScrollableControlTest.cs: Added AutoScrollPositiontest
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms.Layout / ArrangedElementCollection.cs
1 //
2 // ArrangedElementCollection.cs
3 //
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:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
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.
22 //
23 // Copyright (c) 2006 Jonathan Pobst
24 //
25 // Authors:
26 //      Jonathan Pobst (monkey@jpobst.com)
27 //
28 #if NET_2_0
29
30 using System.Collections;
31
32 namespace System.Windows.Forms.Layout
33 {
34         public class ArrangedElementCollection : IList, ICollection, IEnumerable
35         {
36                 internal ArrayList list;
37
38                 internal ArrangedElementCollection ()
39                 {
40                         this.list = new ArrayList ();
41                 }
42
43                 #region Public Properties
44                 public virtual int Count { get { return list.Count; } }
45                 public virtual bool IsReadOnly { get { return list.IsReadOnly; } }
46                 #endregion
47
48                 #region Public Methods
49                 public void CopyTo (Array array, int index)
50                 {
51                         list.CopyTo (array, index);
52                 }
53
54                 public override bool Equals (object other)
55                 {
56                         if (other is ArrangedElementCollection && this == other)
57                                 return (true);
58                         else
59                                 return (false);
60                 }
61
62                 public virtual IEnumerator GetEnumerator ()
63                 {
64                         return list.GetEnumerator ();
65                 }
66
67                 public override int GetHashCode ()
68                 {
69                         return base.GetHashCode ();
70                 }
71                 #endregion
72
73                 #region IList Members
74                 int IList.Add (object value)
75                 {
76                         return Add (value);
77                 }
78
79                 internal int Add (object value)
80                 {
81                         return list.Add (value);
82                 }
83
84                 void IList.Clear ()
85                 {
86                         Clear ();
87                 }
88
89                 internal void Clear ()
90                 {
91                         list.Clear ();
92                 }
93
94                 bool IList.Contains (object value)
95                 {
96                         return Contains (value);
97                 }
98
99                 internal bool Contains (object value)
100                 {
101                         return list.Contains (value);
102                 }
103
104                 int IList.IndexOf (object value)
105                 {
106                         return IndexOf (value);
107                 }
108
109                 internal int IndexOf (object value)
110                 {
111                         return list.IndexOf (value);
112                 }
113
114                 void IList.Insert (int index, object value)
115                 {
116                         Insert (index, value);
117                 }
118
119                 internal void Insert (int index, object value)
120                 {
121                         list.Insert (index, value);
122                 }
123
124                 bool IList.IsFixedSize {
125                         get { return this.IsFixedSize; }
126                 }
127
128                 internal bool IsFixedSize {
129                         get { return list.IsFixedSize; }
130                 }
131
132                 void IList.Remove (object value)
133                 {
134                         Remove (value);
135                 }
136
137                 internal void Remove (object value)
138                 {
139                         list.Remove (value);
140                 }
141
142                 void IList.RemoveAt (int index)
143                 {
144                         RemoveAt (index);
145                 }
146
147                 internal void RemoveAt (int index)
148                 {
149                         list.RemoveAt (index);
150                 }
151
152                 object IList.this[int index] {
153                         get { return this[index]; }
154                         set { this[index] = value; }
155                 }
156
157                 internal object this[int index] {
158                         get { return list[index]; }
159                         set { list[index] = value; }
160                 }
161                 #endregion
162
163                 #region ICollection Members
164                 bool ICollection.IsSynchronized {
165                         get { return list.IsSynchronized; }
166                 }
167
168                 object ICollection.SyncRoot {
169                         get { return list.IsSynchronized; }
170                 }
171                 #endregion
172         }
173 }
174 #endif