MobileListItemCollection.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. //
  2. // Permission is hereby granted, free of charge, to any person obtaining
  3. // a copy of this software and associated documentation files (the
  4. // "Software"), to deal in the Software without restriction, including
  5. // without limitation the rights to use, copy, modify, merge, publish,
  6. // distribute, sublicense, and/or sell copies of the Software, and to
  7. // permit persons to whom the Software is furnished to do so, subject to
  8. // the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be
  11. // included in all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  14. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  16. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  17. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  18. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  19. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. //
  21. /**
  22. * Project : Mono
  23. * Namespace : System.Web.UI.MobileControls
  24. * Class : MobileListItemCollection
  25. * Author : Gaurav Vaish
  26. *
  27. * Copyright : 2003 with Gaurav Vaish, and with
  28. * Ximian Inc
  29. */
  30. using System;
  31. using System.Collections;
  32. using System.Web.UI;
  33. namespace System.Web.UI.MobileControls
  34. {
  35. public class MobileListItemCollection : ArrayListCollectionBase,
  36. IStateManager
  37. {
  38. private int baseIndex = 0;
  39. private bool marked = false;
  40. private bool saveAll = false;
  41. private bool saveSel = false;
  42. public MobileListItemCollection()
  43. {
  44. }
  45. public MobileListItemCollection(ArrayList items) : base(items)
  46. {
  47. }
  48. void IStateManager.LoadViewState(object state)
  49. {
  50. throw new NotImplementedException();
  51. }
  52. object IStateManager.SaveViewState()
  53. {
  54. throw new NotImplementedException();
  55. }
  56. void IStateManager.TrackViewState()
  57. {
  58. this.marked = true;
  59. throw new NotImplementedException();
  60. }
  61. bool IStateManager.IsTrackingViewState
  62. {
  63. get
  64. {
  65. return this.marked;
  66. }
  67. }
  68. public void Add(string item)
  69. {
  70. Add(new MobileListItem(item));
  71. }
  72. public void Add(MobileListItem item)
  73. {
  74. throw new NotImplementedException();
  75. }
  76. public MobileListItem this[int index]
  77. {
  78. get
  79. {
  80. return (MobileListItem)base.Items[index];
  81. }
  82. }
  83. public void Clear()
  84. {
  85. base.Items.Clear();
  86. if(this.marked)
  87. this.saveAll = true;
  88. }
  89. public bool Contains(MobileListItem item)
  90. {
  91. return Items.Contains(item);
  92. }
  93. public MobileListItem[] GetAll()
  94. {
  95. MobileListItem[] retVal = new MobileListItem[Items.Count];
  96. if(Items.Count > 0)
  97. Items.CopyTo(0, retVal, 0, Items.Count);
  98. return retVal;
  99. }
  100. public int IndexOf(MobileListItem item)
  101. {
  102. return Items.IndexOf(item);
  103. }
  104. public virtual void Insert(int index, string item)
  105. {
  106. Insert(index, new MobileListItem(item));
  107. }
  108. public void Insert(int index, MobileListItem item)
  109. {
  110. Items.Insert(index, item);
  111. throw new NotImplementedException();
  112. }
  113. public void Remove(string item)
  114. {
  115. RemoveAt(IndexOf(new MobileListItem(item)));
  116. }
  117. public void Remove(MobileListItem item)
  118. {
  119. RemoveAt(IndexOf(item));
  120. }
  121. public void RemoveAt(int index)
  122. {
  123. if(index >= 0)
  124. {
  125. Items.RemoveAt(index);
  126. throw new NotImplementedException();
  127. }
  128. }
  129. public void SetAll(MobileListItem[] items)
  130. {
  131. throw new NotImplementedException();
  132. }
  133. public int BaseIndex
  134. {
  135. get
  136. {
  137. return this.baseIndex;
  138. }
  139. set
  140. {
  141. this.baseIndex = value;
  142. }
  143. }
  144. public bool SaveSelection
  145. {
  146. get
  147. {
  148. return this.saveSel;
  149. }
  150. set
  151. {
  152. this.saveSel = value;
  153. }
  154. }
  155. }
  156. }