Almost eliminate wrong use of Constants.WsaNamespace.
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / WizardStepCollection.cs
1 //
2 // System.Web.UI.WebControls.WizardStepCollection
3 //
4 // Authors:
5 //  Lluis Sanchez Gual (lluis@novell.com)
6 //
7 // (C) 2005 Novell, Inc. (http://www.novell.com)
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 #if NET_2_0
32
33 using System;
34 using System.Collections;
35
36 namespace System.Web.UI.WebControls
37 {
38         public sealed class WizardStepCollection : IList, ICollection, IEnumerable
39         {
40                 ArrayList list = new ArrayList ();
41                 Wizard wizard;
42                 
43                 internal WizardStepCollection (Wizard wizard)
44                 {
45                         this.wizard = wizard;
46                 }
47                 
48                 public int Count {
49                         get { return list.Count; }
50                 } 
51                 
52                 public bool IsReadOnly {
53                         get { return false; }
54                 } 
55                 
56                 public bool IsSynchronized {
57                         get { return false; }
58                 }
59                 
60                 public WizardStepBase this [int index] {
61                         get { return (WizardStepBase) list [index]; }
62                 }
63                 
64                 public object SyncRoot {
65                         get { return this; }
66                 }
67                 
68                 public void Add (WizardStepBase wizardStep)
69                 {
70                         if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
71                         wizardStep.SetWizard (wizard);
72                         list.Add (wizardStep);
73                         wizard.UpdateViews ();
74                 }
75                 
76                 public void AddAt (int index, WizardStepBase wizardStep)
77                 {
78                         if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
79                         wizardStep.SetWizard (wizard);
80                         list.Insert (index, wizardStep);
81                         wizard.UpdateViews ();
82                 }
83                 
84                 public void Clear ()
85                 {
86                         list.Clear ();
87                         wizard.UpdateViews ();
88                 }
89                 
90                 public bool Contains (WizardStepBase wizardStep)
91                 {
92                         if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
93                         return list.Contains (wizardStep);
94                 }
95                 
96                 public void CopyTo (WizardStepBase[] array, int index)
97                 {
98                         list.CopyTo (array, index);
99                 }
100                 
101                 public IEnumerator GetEnumerator ()
102                 {
103                         return list.GetEnumerator ();
104                 }
105                 
106                 public int IndexOf (WizardStepBase wizardStep)
107                 {
108                         if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
109                         return list.IndexOf (wizardStep);
110                 }
111                 
112                 public void Insert (int index, WizardStepBase wizardStep)
113                 {
114                         AddAt (index, wizardStep);
115                 }
116                 
117                 public void Remove (WizardStepBase wizardStep)
118                 {
119                         if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
120                         list.Remove (wizardStep);
121                         wizard.UpdateViews ();
122                 }
123                 
124                 public void RemoveAt (int index)
125                 {
126                         list.RemoveAt (index);
127                         wizard.UpdateViews ();
128                 }
129                 
130                 bool IList.IsFixedSize {
131                         get { return false; }
132                 }
133                 
134                 object IList.this [int index] {
135                         get { return list [index]; }
136                         set { list [index] = value; }
137                 }
138                 
139                 int IList.Add (object ob)
140                 {
141                         int res = list.Add ((WizardStepBase)ob);
142                         wizard.UpdateViews ();
143                         return res;
144                 }
145                 
146                 bool IList.Contains (object ob)
147                 {
148                         return Contains ((WizardStepBase)ob);
149                 }
150                 
151                 int IList.IndexOf (object ob)
152                 {
153                         return IndexOf ((WizardStepBase)ob);
154                 }
155                 
156                 void IList.Insert (int index, object ob)
157                 {
158                         AddAt (index, (WizardStepBase)ob);
159                 }
160                 
161                 void IList.Remove (object ob)
162                 {
163                         Remove ((WizardStepBase)ob);
164                 }
165                 
166                 void ICollection.CopyTo (Array array, int index)
167                 {
168                         list.CopyTo (array, index);
169                 }
170         }
171 }
172
173 #endif