2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
[mono.git] / mcs / class / System.Web.Mobile / System.Web.UI.MobileControls / MobileListItemCollection.cs
1 /**
2  * Project   : Mono
3  * Namespace : System.Web.UI.MobileControls
4  * Class     : MobileListItemCollection
5  * Author    : Gaurav Vaish
6  *
7  * Copyright : 2003 with Gaurav Vaish, and with
8  *             Ximian Inc
9  */
10
11 using System;
12 using System.Collections;
13 using System.Web.UI;
14
15 namespace System.Web.UI.MobileControls
16 {
17         public class MobileListItemCollection : ArrayListCollectionBase,
18                                                 IStateManager
19         {
20                 private int baseIndex = 0;
21
22                 private bool marked  = false;
23                 private bool saveAll = false;
24                 private bool saveSel = false;
25
26                 public MobileListItemCollection()
27                 {
28                 }
29
30                 public MobileListItemCollection(ArrayList items) : base(items)
31                 {
32                 }
33
34                 void IStateManager.LoadViewState(object state)
35                 {
36                         throw new NotImplementedException();
37                 }
38
39                 object IStateManager.SaveViewState()
40                 {
41                         throw new NotImplementedException();
42                 }
43
44                 void IStateManager.TrackViewState()
45                 {
46                         this.marked = true;
47                         throw new NotImplementedException();
48                 }
49
50                 bool IStateManager.IsTrackingViewState
51                 {
52                         get
53                         {
54                                 return this.marked;
55                         }
56                 }
57
58                 public void Add(string item)
59                 {
60                         Add(new MobileListItem(item));
61                 }
62
63                 public void Add(MobileListItem item)
64                 {
65                         throw new NotImplementedException();
66                 }
67
68                 public MobileListItem this[int index]
69                 {
70                         get
71                         {
72                                 return (MobileListItem)base.Items[index];
73                         }
74                 }
75
76                 public void Clear()
77                 {
78                         base.Items.Clear();
79                         if(this.marked)
80                                 this.saveAll = true;
81                 }
82
83                 public bool Contains(MobileListItem item)
84                 {
85                         return Items.Contains(item);
86                 }
87
88                 public MobileListItem[] GetAll()
89                 {
90                         MobileListItem[] retVal = new MobileListItem[Items.Count];
91                         if(Items.Count > 0)
92                                 Items.CopyTo(0, retVal, 0, Items.Count);
93                         return retVal;
94                 }
95
96                 public int IndexOf(MobileListItem item)
97                 {
98                         return Items.IndexOf(item);
99                 }
100
101                 public virtual void Insert(int index, string item)
102                 {
103                         Insert(index, new MobileListItem(item));
104                 }
105
106                 public void Insert(int index, MobileListItem item)
107                 {
108                         Items.Insert(index, item);
109                         throw new NotImplementedException();
110                 }
111
112                 public void Remove(string item)
113                 {
114                         RemoveAt(IndexOf(new MobileListItem(item)));
115                 }
116
117                 public void Remove(MobileListItem item)
118                 {
119                         RemoveAt(IndexOf(item));
120                 }
121
122                 public void RemoveAt(int index)
123                 {
124                         if(index >= 0)
125                         {
126                                 Items.RemoveAt(index);
127                                 throw new NotImplementedException();
128                         }
129                 }
130
131                 public void SetAll(MobileListItem[] items)
132                 {
133                         throw new NotImplementedException();
134                 }
135
136                 public int BaseIndex
137                 {
138                         get
139                         {
140                                 return this.baseIndex;
141                         }
142                         set
143                         {
144                                 this.baseIndex = value;
145                         }
146                 }
147
148                 public bool SaveSelection
149                 {
150                         get
151                         {
152                                 return this.saveSel;
153                         }
154                         set
155                         {
156                                 this.saveSel = value;
157                         }
158                 }
159         }
160 }