~ubuntu-branches/ubuntu/hoary/monodevelop/hoary

« back to all changes in this revision

Viewing changes to src/Main/Base/Gui/PadContentCollection.cs

  • Committer: Bazaar Package Importer
  • Author(s): Brandon Hale
  • Date: 2004-10-07 11:51:11 UTC
  • Revision ID: james.westby@ubuntu.com-20041007115111-pxcqnwfxyq5mhcx5
Tags: 0.5.1-3
Use dh_netdeps in debian/rules and debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// <file>
 
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"/>
 
6
// </file>
 
7
using System;
 
8
using System.Collections;
 
9
 
 
10
namespace MonoDevelop.Gui
 
11
{
 
12
        /// <summary>
 
13
        ///     <para>
 
14
        ///       A collection that stores <see cref='.IPadContent'/> objects.
 
15
        ///    </para>
 
16
        /// </summary>
 
17
        /// <seealso cref='.PadContentCollection'/>
 
18
        [Serializable()]
 
19
        public class PadContentCollection : CollectionBase {
 
20
                
 
21
                /// <summary>
 
22
                ///     <para>
 
23
                ///       Initializes a new instance of <see cref='.PadContentCollection'/>.
 
24
                ///    </para>
 
25
                /// </summary>
 
26
                public PadContentCollection() {
 
27
                }
 
28
                
 
29
                /// <summary>
 
30
                ///     <para>
 
31
                ///       Initializes a new instance of <see cref='.PadContentCollection'/> based on another <see cref='.PadContentCollection'/>.
 
32
                ///    </para>
 
33
                /// </summary>
 
34
                /// <param name='value'>
 
35
                ///       A <see cref='.PadContentCollection'/> from which the contents are copied
 
36
                /// </param>
 
37
                public PadContentCollection(PadContentCollection value) {
 
38
                        this.AddRange(value);
 
39
                }
 
40
                
 
41
                /// <summary>
 
42
                ///     <para>
 
43
                ///       Initializes a new instance of <see cref='.PadContentCollection'/> containing any array of <see cref='.IPadContent'/> objects.
 
44
                ///    </para>
 
45
                /// </summary>
 
46
                /// <param name='value'>
 
47
                ///       A array of <see cref='.IPadContent'/> objects with which to intialize the collection
 
48
                /// </param>
 
49
                public PadContentCollection(IPadContent[] value) {
 
50
                        this.AddRange(value);
 
51
                }
 
52
                
 
53
                /// <summary>
 
54
                /// <para>Represents the entry at the specified index of the <see cref='.IPadContent'/>.</para>
 
55
                /// </summary>
 
56
                /// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
 
57
                /// <value>
 
58
                ///    <para> The entry at the specified index of the collection.</para>
 
59
                /// </value>
 
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] {
 
62
                        get {
 
63
                                return ((IPadContent)(List[index]));
 
64
                        }
 
65
                        set {
 
66
                                List[index] = value;
 
67
                        }
 
68
                }
 
69
                
 
70
                public IPadContent this[string typeName] {
 
71
                        get {
 
72
                                foreach (IPadContent padContent in this) {
 
73
                                        if (padContent.GetType().FullName == typeName) {
 
74
                                                return padContent;
 
75
                                        }
 
76
                                }
 
77
                                return null;
 
78
                        }
 
79
                }
 
80
                
 
81
                
 
82
                
 
83
                /// <summary>
 
84
                ///    <para>Adds a <see cref='.IPadContent'/> with the specified value to the
 
85
                ///    <see cref='.PadContentCollection'/> .</para>
 
86
                /// </summary>
 
87
                /// <param name='value'>The <see cref='.IPadContent'/> to add.</param>
 
88
                /// <returns>
 
89
                ///    <para>The index at which the new element was inserted.</para>
 
90
                /// </returns>
 
91
                /// <seealso cref='.PadContentCollection.AddRange'/>
 
92
                public int Add(IPadContent value) {
 
93
                        return List.Add(value);
 
94
                }
 
95
                
 
96
                /// <summary>
 
97
                /// <para>Copies the elements of an array to the end of the <see cref='.PadContentCollection'/>.</para>
 
98
                /// </summary>
 
99
                /// <param name='value'>
 
100
                ///    An array of type <see cref='.IPadContent'/> containing the objects to add to the collection.
 
101
                /// </param>
 
102
                /// <returns>
 
103
                ///   <para>None.</para>
 
104
                /// </returns>
 
105
                /// <seealso cref='.PadContentCollection.Add'/>
 
106
                public void AddRange(IPadContent[] value) {
 
107
                        for (int i = 0; (i < value.Length); i = (i + 1)) {
 
108
                                this.Add(value[i]);
 
109
                        }
 
110
                }
 
111
                
 
112
                /// <summary>
 
113
                ///     <para>
 
114
                ///       Adds the contents of another <see cref='.PadContentCollection'/> to the end of the collection.
 
115
                ///    </para>
 
116
                /// </summary>
 
117
                /// <param name='value'>
 
118
                ///    A <see cref='.PadContentCollection'/> containing the objects to add to the collection.
 
119
                /// </param>
 
120
                /// <returns>
 
121
                ///   <para>None.</para>
 
122
                /// </returns>
 
123
                /// <seealso cref='.PadContentCollection.Add'/>
 
124
                public void AddRange(PadContentCollection value) {
 
125
                        for (int i = 0; (i < value.Count); i = (i + 1)) {
 
126
                                this.Add(value[i]);
 
127
                        }
 
128
                }
 
129
                
 
130
                /// <summary>
 
131
                /// <para>Gets a value indicating whether the
 
132
                ///    <see cref='.PadContentCollection'/> contains the specified <see cref='.IPadContent'/>.</para>
 
133
                /// </summary>
 
134
                /// <param name='value'>The <see cref='.IPadContent'/> to locate.</param>
 
135
                /// <returns>
 
136
                /// <para><see langword='true'/> if the <see cref='.IPadContent'/> is contained in the collection;
 
137
                ///   otherwise, <see langword='false'/>.</para>
 
138
                /// </returns>
 
139
                /// <seealso cref='.PadContentCollection.IndexOf'/>
 
140
                public bool Contains(IPadContent value) {
 
141
                        return List.Contains(value);
 
142
                }
 
143
                
 
144
                /// <summary>
 
145
                /// <para>Copies the <see cref='.PadContentCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
 
146
                ///    specified index.</para>
 
147
                /// </summary>
 
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>
 
150
                /// <returns>
 
151
                ///   <para>None.</para>
 
152
                /// </returns>
 
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);
 
159
                }
 
160
                
 
161
                /// <summary>
 
162
                ///    <para>Returns the index of a <see cref='.IPadContent'/> in
 
163
                ///       the <see cref='.PadContentCollection'/> .</para>
 
164
                /// </summary>
 
165
                /// <param name='value'>The <see cref='.IPadContent'/> to locate.</param>
 
166
                /// <returns>
 
167
                /// <para>The index of the <see cref='.IPadContent'/> of <paramref name='value'/> in the
 
168
                /// <see cref='.PadContentCollection'/>, if found; otherwise, -1.</para>
 
169
                /// </returns>
 
170
                /// <seealso cref='.PadContentCollection.Contains'/>
 
171
                public int IndexOf(IPadContent value) {
 
172
                        return List.IndexOf(value);
 
173
                }
 
174
                
 
175
                /// <summary>
 
176
                /// <para>Inserts a <see cref='.IPadContent'/> into the <see cref='.PadContentCollection'/> at the specified index.</para>
 
177
                /// </summary>
 
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);
 
184
                }
 
185
                
 
186
                /// <summary>
 
187
                ///    <para>Returns an enumerator that can iterate through
 
188
                ///       the <see cref='.PadContentCollection'/> .</para>
 
189
                /// </summary>
 
190
                /// <returns><para>None.</para></returns>
 
191
                /// <seealso cref='System.Collections.IEnumerator'/>
 
192
                public new IPadContentEnumerator GetEnumerator() {
 
193
                        return new IPadContentEnumerator(this);
 
194
                }
 
195
                
 
196
                /// <summary>
 
197
                ///    <para> Removes a specific <see cref='.IPadContent'/> from the
 
198
                ///    <see cref='.PadContentCollection'/> .</para>
 
199
                /// </summary>
 
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) {
 
204
                        List.Remove(value);
 
205
                }
 
206
                
 
207
                public class IPadContentEnumerator : object, IEnumerator {
 
208
                        
 
209
                        private IEnumerator baseEnumerator;
 
210
                        
 
211
                        private IEnumerable temp;
 
212
                        
 
213
                        public IPadContentEnumerator(PadContentCollection mappings) {
 
214
                                this.temp = ((IEnumerable)(mappings));
 
215
                                this.baseEnumerator = temp.GetEnumerator();
 
216
                        }
 
217
                        
 
218
                        public IPadContent Current {
 
219
                                get {
 
220
                                        return ((IPadContent)(baseEnumerator.Current));
 
221
                                }
 
222
                        }
 
223
                        
 
224
                        object IEnumerator.Current {
 
225
                                get {
 
226
                                        return baseEnumerator.Current;
 
227
                                }
 
228
                        }
 
229
                        
 
230
                        public bool MoveNext() {
 
231
                                return baseEnumerator.MoveNext();
 
232
                        }
 
233
                        
 
234
                        bool IEnumerator.MoveNext() {
 
235
                                return baseEnumerator.MoveNext();
 
236
                        }
 
237
                        
 
238
                        public void Reset() {
 
239
                                baseEnumerator.Reset();
 
240
                        }
 
241
                        
 
242
                        void IEnumerator.Reset() {
 
243
                                baseEnumerator.Reset();
 
244
                        }
 
245
                }
 
246
        }
 
247
}