ArrangedElementCollection.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. //
  2. // ArrangedElementCollection.cs
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining
  5. // a copy of this software and associated documentation files (the
  6. // "Software"), to deal in the Software without restriction, including
  7. // without limitation the rights to use, copy, modify, merge, publish,
  8. // distribute, sublicense, and/or sell copies of the Software, and to
  9. // permit persons to whom the Software is furnished to do so, subject to
  10. // the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be
  13. // included in all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  19. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  20. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  21. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. //
  23. // Copyright (c) 2006 Jonathan Pobst
  24. //
  25. // Authors:
  26. // Jonathan Pobst ([email protected])
  27. //
  28. #if NET_2_0
  29. using System.Collections;
  30. namespace System.Windows.Forms.Layout
  31. {
  32. public class ArrangedElementCollection : IList, ICollection, IEnumerable
  33. {
  34. internal ArrayList list;
  35. internal ArrangedElementCollection ()
  36. {
  37. this.list = new ArrayList ();
  38. }
  39. #region Public Properties
  40. public virtual int Count { get { return list.Count; } }
  41. public virtual bool IsReadOnly { get { return list.IsReadOnly; } }
  42. #endregion
  43. #region Public Methods
  44. public void CopyTo (Array array, int index)
  45. {
  46. list.CopyTo (array, index);
  47. }
  48. public override bool Equals (object other)
  49. {
  50. if (other is ArrangedElementCollection && this == other)
  51. return (true);
  52. else
  53. return (false);
  54. }
  55. public virtual IEnumerator GetEnumerator ()
  56. {
  57. return list.GetEnumerator ();
  58. }
  59. public override int GetHashCode ()
  60. {
  61. return base.GetHashCode ();
  62. }
  63. #endregion
  64. #region IList Members
  65. int IList.Add (object value)
  66. {
  67. return Add (value);
  68. }
  69. internal int Add (object value)
  70. {
  71. return list.Add (value);
  72. }
  73. void IList.Clear ()
  74. {
  75. Clear ();
  76. }
  77. internal void Clear ()
  78. {
  79. list.Clear ();
  80. }
  81. bool IList.Contains (object value)
  82. {
  83. return Contains (value);
  84. }
  85. internal bool Contains (object value)
  86. {
  87. return list.Contains (value);
  88. }
  89. int IList.IndexOf (object value)
  90. {
  91. return IndexOf (value);
  92. }
  93. internal int IndexOf (object value)
  94. {
  95. return list.IndexOf (value);
  96. }
  97. void IList.Insert (int index, object value)
  98. {
  99. Insert (index, value);
  100. }
  101. internal void Insert (int index, object value)
  102. {
  103. list.Insert (index, value);
  104. }
  105. bool IList.IsFixedSize {
  106. get { return this.IsFixedSize; }
  107. }
  108. internal bool IsFixedSize {
  109. get { return list.IsFixedSize; }
  110. }
  111. void IList.Remove (object value)
  112. {
  113. Remove (value);
  114. }
  115. internal void Remove (object value)
  116. {
  117. list.Remove (value);
  118. }
  119. void IList.RemoveAt (int index)
  120. {
  121. RemoveAt (index);
  122. }
  123. internal void RemoveAt (int index)
  124. {
  125. list.RemoveAt (index);
  126. }
  127. object IList.this[int index] {
  128. get { return this[index]; }
  129. set { this[index] = value; }
  130. }
  131. internal object this[int index] {
  132. get { return list[index]; }
  133. set { list[index] = value; }
  134. }
  135. #endregion
  136. #region ICollection Members
  137. bool ICollection.IsSynchronized {
  138. get { return list.IsSynchronized; }
  139. }
  140. object ICollection.SyncRoot {
  141. get { return list.IsSynchronized; }
  142. }
  143. #endregion
  144. }
  145. }
  146. #endif