Flush pending changes I got from a contributor that did not put his name in
[mono.git] / mcs / class / System.Web / System.Web.UI.HtmlControls / HtmlTableCellCollection.cs
1 /*      System.Web.UI.HtmlControls
2 *       Authors
3 *               Leen Toelen (toelen@hotmail.com)
4 */
5
6 using System;
7 using System.Web;
8 using System.Web.UI;
9 using System.Collections;
10
11 namespace System.Web.UI.HtmlControls{
12         public sealed class HtmlTableCellCollection : ICollection {
13                 private HtmlTableRow _owner;
14                 
15                 internal HtmlTableCellCollection(HtmlTableRow owner){
16                         _owner = owner;
17                 }
18                 
19                 public void Add(HtmlTableCell cell){
20                         Insert(-1, cell);
21                 }
22                 
23                 public void Clear(){
24                         if (_owner.HasControls()) _owner.Controls.Clear();
25                 }
26                 
27                 public void CopyTo(Array array, int index){
28                         //FIXME: convert to foreach loop
29                         IEnumerator i = GetEnumerator();
30                         while(i.MoveNext()){
31                                 array.SetValue(i.Current, index++);
32                         }
33                 }
34                 
35                 public IEnumerator GetEnumerator(){
36                         return _owner.Controls.GetEnumerator();
37                 }
38                 
39                 public void Insert(int index, HtmlTableCell cell){
40                         _owner.Controls.AddAt(index,cell);
41                 }
42                 
43                 public void Remove(HtmlTableCell cell){
44                         _owner.Controls.Remove(cell);
45                 }
46                 
47                 public void RemoveAt(int index){
48                         _owner.Controls.RemoveAt(index);
49                 }
50                 
51                 public int Count {
52                         get{
53                                 if (_owner.HasControls()) return _owner.Controls.Count;
54                                 return 0;
55                         }
56                 }
57                 
58                 public bool IsReadOnly {
59                         get{
60                                 return false;
61                         }
62                 }
63                 
64                 public bool IsSynchronized {
65                         get{
66                                 return false;
67                         }
68                 }
69                 
70                 public HtmlTableRow this[int index] {
71                         get{
72                                 return (HtmlTableRow) _owner.Controls[index];
73                         }
74                 }
75                 
76                 public object SyncRoot {
77                         get{
78                                 return null;
79                         }
80                 }
81                 
82         } // end of System.Web.UI.HtmlControls.HtmlTableCellCollection
83         
84 }