2 // System.Web.UI.WebControls.WizardStepCollection
5 // Lluis Sanchez Gual (lluis@novell.com)
7 // (C) 2005 Novell, Inc. (http://www.novell.com)
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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.
34 using System.Collections;
36 namespace System.Web.UI.WebControls
38 public sealed class WizardStepCollection: IList
40 ArrayList list = new ArrayList ();
43 internal WizardStepCollection (Wizard wizard)
49 get { return list.Count; }
52 public bool IsReadOnly {
56 public bool IsSynchronized {
60 public WizardStepBase this [int index] {
61 get { return (WizardStepBase) list [index]; }
64 public object SyncRoot {
68 public void Add (WizardStepBase wizardStep)
70 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
71 list.Add (wizardStep);
72 wizard.UpdateViews ();
75 public void AddAt (int index, WizardStepBase wizardStep)
77 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
78 list.Insert (index, wizardStep);
79 wizard.UpdateViews ();
85 wizard.UpdateViews ();
88 public bool Contains (WizardStepBase wizardStep)
90 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
91 return list.Contains (wizardStep);
94 public void CopyTo (WizardStepBase[] array, int index)
96 list.CopyTo (array, index);
99 public IEnumerator GetEnumerator ()
101 return list.GetEnumerator ();
104 public int IndexOf (WizardStepBase wizardStep)
106 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
107 return list.IndexOf (wizardStep);
110 public void Insert (int index, WizardStepBase wizardStep)
112 AddAt (index, wizardStep);
115 public void Remove (WizardStepBase wizardStep)
117 if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
118 list.Remove (wizardStep);
119 wizard.UpdateViews ();
122 public void RemoveAt (int index)
124 list.RemoveAt (index);
125 wizard.UpdateViews ();
128 bool IList.IsFixedSize {
129 get { return false; }
132 object IList.this [int index] {
133 get { return list [index]; }
134 set { list [index] = value; }
137 int IList.Add (object ob)
139 int res = list.Add ((WizardStepBase)ob);
140 wizard.UpdateViews ();
144 bool IList.Contains (object ob)
146 return Contains ((WizardStepBase)ob);
149 int IList.IndexOf (object ob)
151 return IndexOf ((WizardStepBase)ob);
154 void IList.Insert (int index, object ob)
156 AddAt (index, (WizardStepBase)ob);
159 void IList.Remove (object ob)
161 Remove ((WizardStepBase)ob);
164 void ICollection.CopyTo (Array array, int index)
166 list.CopyTo (array, index);