1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
//------------------------------------------------------------------------------
// <copyright file="HtmlTableCellCollection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
/*
* HtmlTableCellCollection.cs
*
* Copyright (c) 2000 Microsoft Corporation
*/
namespace System.Web.UI.HtmlControls {
using System.Runtime.InteropServices;
using System;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Security.Permissions;
/// <devdoc>
/// <para>
/// The <see langword='HtmlTableCellCollection'/> contains all of the table
/// cells, both <td> and <th> elements, found within an <see langword='HtmlTable'/>
/// server control.
/// </para>
/// </devdoc>
public sealed class HtmlTableCellCollection : ICollection {
/// <internalonly/>
/// <devdoc>
/// </devdoc>
private HtmlTableRow owner;
internal HtmlTableCellCollection(HtmlTableRow owner) {
this.owner = owner;
}
/*
* The number of cells in the row.
*/
/// <devdoc>
/// <para>
/// Gets the number of items in the <see langword='HtmlTableCell'/>
/// collection.
/// </para>
/// </devdoc>
public int Count {
get {
if (owner.HasControls())
return owner.Controls.Count;
return 0;
}
}
/// <devdoc>
/// <para>
/// Gets an <see langword='HtmlTableCell'/> control from an
/// <see langword='HtmlTable'/> control thorugh the cell's ordinal index value.
/// </para>
/// </devdoc>
public HtmlTableCell this[int index]
{
get {
return(HtmlTableCell)owner.Controls[index];
}
}
/// <devdoc>
/// <para>
/// Adds the specified <see langword='HtmlTableCell'/> control to the end of the
/// collection.
/// </para>
/// </devdoc>
public void Add(HtmlTableCell cell) {
Insert(-1, cell);
}
/// <devdoc>
/// <para>
/// Adds an <see langword='HtmlTableCell'/> control to a specified location in the
/// collection.
/// </para>
/// </devdoc>
public void Insert(int index, HtmlTableCell cell) {
owner.Controls.AddAt(index, cell);
}
/// <devdoc>
/// <para>
/// Deletes all <see langword='HtmlTableCell'/>
/// controls from the collection.
/// </para>
/// </devdoc>
public void Clear() {
if (owner.HasControls())
owner.Controls.Clear();
}
/*
* Returns an enumerator that enumerates over the cells in a table row in order.
*/
/// <devdoc>
/// </devdoc>
public IEnumerator GetEnumerator() {
return owner.Controls.GetEnumerator();
}
/// <devdoc>
/// </devdoc>
public void CopyTo(Array array, int index) {
for (IEnumerator e = this.GetEnumerator(); e.MoveNext();)
array.SetValue(e.Current, index++);
}
/// <devdoc>
/// </devdoc>
public Object SyncRoot {
get { return this;}
}
/// <devdoc>
/// </devdoc>
public bool IsReadOnly {
get { return false;}
}
/// <devdoc>
/// </devdoc>
public bool IsSynchronized {
get { return false;}
}
/// <devdoc>
/// <para>
/// Deletes the specified <see langword='HtmlTableCell'/> control from the
/// collection.
/// </para>
/// </devdoc>
public void Remove(HtmlTableCell cell) {
owner.Controls.Remove(cell);
}
/// <devdoc>
/// <para>
/// Deletes the <see langword='HtmlTableCell'/> control at the specified index
/// location from the collection.
/// </para>
/// </devdoc>
public void RemoveAt(int index) {
owner.Controls.RemoveAt(index);
}
}
}
|