PageRenderTime 30ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ArrangedElementCollection.cs

https://bitbucket.org/danipen/mono
C# | 172 lines | 117 code | 28 blank | 27 comment | 3 complexity | 00392dbbe855e0154853a7327d9f5e36 MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0
  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 (monkey@jpobst.com)
  27. //
  28. using System.Collections;
  29. namespace System.Windows.Forms.Layout
  30. {
  31. public class ArrangedElementCollection : IList, ICollection, IEnumerable
  32. {
  33. internal ArrayList list;
  34. internal ArrangedElementCollection ()
  35. {
  36. this.list = new ArrayList ();
  37. }
  38. #region Public Properties
  39. public virtual int Count { get { return list.Count; } }
  40. public virtual bool IsReadOnly { get { return list.IsReadOnly; } }
  41. #endregion
  42. #region Public Methods
  43. public void CopyTo (Array array, int index)
  44. {
  45. list.CopyTo (array, index);
  46. }
  47. public override bool Equals (object obj)
  48. {
  49. if (obj is ArrangedElementCollection && this == obj)
  50. return (true);
  51. else
  52. return (false);
  53. }
  54. public virtual IEnumerator GetEnumerator ()
  55. {
  56. return list.GetEnumerator ();
  57. }
  58. public override int GetHashCode ()
  59. {
  60. return base.GetHashCode ();
  61. }
  62. #endregion
  63. #region IList Members
  64. int IList.Add (object value)
  65. {
  66. return Add (value);
  67. }
  68. internal int Add (object value)
  69. {
  70. return list.Add (value);
  71. }
  72. void IList.Clear ()
  73. {
  74. Clear ();
  75. }
  76. internal void Clear ()
  77. {
  78. list.Clear ();
  79. }
  80. bool IList.Contains (object value)
  81. {
  82. return Contains (value);
  83. }
  84. internal bool Contains (object value)
  85. {
  86. return list.Contains (value);
  87. }
  88. int IList.IndexOf (object value)
  89. {
  90. return IndexOf (value);
  91. }
  92. internal int IndexOf (object value)
  93. {
  94. return list.IndexOf (value);
  95. }
  96. void IList.Insert (int index, object value)
  97. {
  98. throw new NotSupportedException ();
  99. }
  100. internal void Insert (int index, object value)
  101. {
  102. list.Insert (index, value);
  103. }
  104. bool IList.IsFixedSize {
  105. get { return this.IsFixedSize; }
  106. }
  107. internal bool IsFixedSize {
  108. get { return list.IsFixedSize; }
  109. }
  110. void IList.Remove (object value)
  111. {
  112. Remove (value);
  113. }
  114. internal void Remove (object value)
  115. {
  116. list.Remove (value);
  117. }
  118. void IList.RemoveAt (int index)
  119. {
  120. list.RemoveAt (index);
  121. }
  122. internal void InternalRemoveAt (int index)
  123. {
  124. list.RemoveAt (index);
  125. }
  126. object IList.this[int index] {
  127. get { return this[index]; }
  128. set { this[index] = value; }
  129. }
  130. internal object this[int index] {
  131. get { return list[index]; }
  132. set { list[index] = value; }
  133. }
  134. #endregion
  135. #region ICollection Members
  136. bool ICollection.IsSynchronized {
  137. get { return list.IsSynchronized; }
  138. }
  139. object ICollection.SyncRoot {
  140. get { return list.IsSynchronized; }
  141. }
  142. #endregion
  143. }
  144. }