2010-03-02 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.Web / System.Web.UI.WebControls / WizardStepCollection.cs
blobab94e23dac23e7439c1cc46d89af4bd3bb368a16
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 //
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.
31 #if NET_2_0
33 using System;
34 using System.Collections;
36 namespace System.Web.UI.WebControls
38 public sealed class WizardStepCollection : IList, ICollection, IEnumerable
40 ArrayList list = new ArrayList ();
41 Wizard wizard;
43 internal WizardStepCollection (Wizard wizard)
45 this.wizard = wizard;
48 public int Count {
49 get { return list.Count; }
52 public bool IsReadOnly {
53 get { return false; }
56 public bool IsSynchronized {
57 get { return false; }
60 public WizardStepBase this [int index] {
61 get { return (WizardStepBase) list [index]; }
64 public object SyncRoot {
65 get { return this; }
68 public void Add (WizardStepBase wizardStep)
70 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
71 wizardStep.SetWizard (wizard);
72 list.Add (wizardStep);
73 wizard.UpdateViews ();
76 public void AddAt (int index, WizardStepBase wizardStep)
78 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
79 wizardStep.SetWizard (wizard);
80 list.Insert (index, wizardStep);
81 wizard.UpdateViews ();
84 public void Clear ()
86 list.Clear ();
87 wizard.UpdateViews ();
90 public bool Contains (WizardStepBase wizardStep)
92 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
93 return list.Contains (wizardStep);
96 public void CopyTo (WizardStepBase[] array, int index)
98 list.CopyTo (array, index);
101 public IEnumerator GetEnumerator ()
103 return list.GetEnumerator ();
106 public int IndexOf (WizardStepBase wizardStep)
108 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
109 return list.IndexOf (wizardStep);
112 public void Insert (int index, WizardStepBase wizardStep)
114 AddAt (index, wizardStep);
117 public void Remove (WizardStepBase wizardStep)
119 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
120 list.Remove (wizardStep);
121 wizard.UpdateViews ();
124 public void RemoveAt (int index)
126 list.RemoveAt (index);
127 wizard.UpdateViews ();
130 bool IList.IsFixedSize {
131 get { return false; }
134 object IList.this [int index] {
135 get { return list [index]; }
136 set { list [index] = value; }
139 int IList.Add (object ob)
141 int res = list.Add ((WizardStepBase)ob);
142 wizard.UpdateViews ();
143 return res;
146 bool IList.Contains (object ob)
148 return Contains ((WizardStepBase)ob);
151 int IList.IndexOf (object ob)
153 return IndexOf ((WizardStepBase)ob);
156 void IList.Insert (int index, object ob)
158 AddAt (index, (WizardStepBase)ob);
161 void IList.Remove (object ob)
163 Remove ((WizardStepBase)ob);
166 void ICollection.CopyTo (Array array, int index)
168 list.CopyTo (array, index);
173 #endif