2
// <copyright see="prj:///doc/copyright.txt"/>
3
// <license see="prj:///doc/license.txt"/>
4
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
5
// <version value="$version"/>
8
using System.Collections;
10
namespace MonoDevelop.Gui
14
/// A collection that stores <see cref='.IPadContent'/> objects.
17
/// <seealso cref='.PadContentCollection'/>
19
public class PadContentCollection : CollectionBase {
23
/// Initializes a new instance of <see cref='.PadContentCollection'/>.
26
public PadContentCollection() {
31
/// Initializes a new instance of <see cref='.PadContentCollection'/> based on another <see cref='.PadContentCollection'/>.
34
/// <param name='value'>
35
/// A <see cref='.PadContentCollection'/> from which the contents are copied
37
public PadContentCollection(PadContentCollection value) {
43
/// Initializes a new instance of <see cref='.PadContentCollection'/> containing any array of <see cref='.IPadContent'/> objects.
46
/// <param name='value'>
47
/// A array of <see cref='.IPadContent'/> objects with which to intialize the collection
49
public PadContentCollection(IPadContent[] value) {
54
/// <para>Represents the entry at the specified index of the <see cref='.IPadContent'/>.</para>
56
/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
58
/// <para> The entry at the specified index of the collection.</para>
60
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
61
public IPadContent this[int index] {
63
return ((IPadContent)(List[index]));
70
public IPadContent this[string typeName] {
72
foreach (IPadContent padContent in this) {
73
if (padContent.GetType().FullName == typeName) {
84
/// <para>Adds a <see cref='.IPadContent'/> with the specified value to the
85
/// <see cref='.PadContentCollection'/> .</para>
87
/// <param name='value'>The <see cref='.IPadContent'/> to add.</param>
89
/// <para>The index at which the new element was inserted.</para>
91
/// <seealso cref='.PadContentCollection.AddRange'/>
92
public int Add(IPadContent value) {
93
return List.Add(value);
97
/// <para>Copies the elements of an array to the end of the <see cref='.PadContentCollection'/>.</para>
99
/// <param name='value'>
100
/// An array of type <see cref='.IPadContent'/> containing the objects to add to the collection.
103
/// <para>None.</para>
105
/// <seealso cref='.PadContentCollection.Add'/>
106
public void AddRange(IPadContent[] value) {
107
for (int i = 0; (i < value.Length); i = (i + 1)) {
114
/// Adds the contents of another <see cref='.PadContentCollection'/> to the end of the collection.
117
/// <param name='value'>
118
/// A <see cref='.PadContentCollection'/> containing the objects to add to the collection.
121
/// <para>None.</para>
123
/// <seealso cref='.PadContentCollection.Add'/>
124
public void AddRange(PadContentCollection value) {
125
for (int i = 0; (i < value.Count); i = (i + 1)) {
131
/// <para>Gets a value indicating whether the
132
/// <see cref='.PadContentCollection'/> contains the specified <see cref='.IPadContent'/>.</para>
134
/// <param name='value'>The <see cref='.IPadContent'/> to locate.</param>
136
/// <para><see langword='true'/> if the <see cref='.IPadContent'/> is contained in the collection;
137
/// otherwise, <see langword='false'/>.</para>
139
/// <seealso cref='.PadContentCollection.IndexOf'/>
140
public bool Contains(IPadContent value) {
141
return List.Contains(value);
145
/// <para>Copies the <see cref='.PadContentCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
146
/// specified index.</para>
148
/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='.PadContentCollection'/> .</para></param>
149
/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
151
/// <para>None.</para>
153
/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='.PadContentCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
154
/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
155
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
156
/// <seealso cref='System.Array'/>
157
public void CopyTo(IPadContent[] array, int index) {
158
List.CopyTo(array, index);
162
/// <para>Returns the index of a <see cref='.IPadContent'/> in
163
/// the <see cref='.PadContentCollection'/> .</para>
165
/// <param name='value'>The <see cref='.IPadContent'/> to locate.</param>
167
/// <para>The index of the <see cref='.IPadContent'/> of <paramref name='value'/> in the
168
/// <see cref='.PadContentCollection'/>, if found; otherwise, -1.</para>
170
/// <seealso cref='.PadContentCollection.Contains'/>
171
public int IndexOf(IPadContent value) {
172
return List.IndexOf(value);
176
/// <para>Inserts a <see cref='.IPadContent'/> into the <see cref='.PadContentCollection'/> at the specified index.</para>
178
/// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param>
179
/// <param name=' value'>The <see cref='.IPadContent'/> to insert.</param>
180
/// <returns><para>None.</para></returns>
181
/// <seealso cref='.PadContentCollection.Add'/>
182
public void Insert(int index, IPadContent value) {
183
List.Insert(index, value);
187
/// <para>Returns an enumerator that can iterate through
188
/// the <see cref='.PadContentCollection'/> .</para>
190
/// <returns><para>None.</para></returns>
191
/// <seealso cref='System.Collections.IEnumerator'/>
192
public new IPadContentEnumerator GetEnumerator() {
193
return new IPadContentEnumerator(this);
197
/// <para> Removes a specific <see cref='.IPadContent'/> from the
198
/// <see cref='.PadContentCollection'/> .</para>
200
/// <param name='value'>The <see cref='.IPadContent'/> to remove from the <see cref='.PadContentCollection'/> .</param>
201
/// <returns><para>None.</para></returns>
202
/// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
203
public void Remove(IPadContent value) {
207
public class IPadContentEnumerator : object, IEnumerator {
209
private IEnumerator baseEnumerator;
211
private IEnumerable temp;
213
public IPadContentEnumerator(PadContentCollection mappings) {
214
this.temp = ((IEnumerable)(mappings));
215
this.baseEnumerator = temp.GetEnumerator();
218
public IPadContent Current {
220
return ((IPadContent)(baseEnumerator.Current));
224
object IEnumerator.Current {
226
return baseEnumerator.Current;
230
public bool MoveNext() {
231
return baseEnumerator.MoveNext();
234
bool IEnumerator.MoveNext() {
235
return baseEnumerator.MoveNext();
238
public void Reset() {
239
baseEnumerator.Reset();
242
void IEnumerator.Reset() {
243
baseEnumerator.Reset();