2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / System.Web.Mobile / System.Web.UI.MobileControls / List.cs
1
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
10 // 
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 // 
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 /**
23  * Project   : Mono
24  * Namespace : System.Web.UI.MobileControls
25  * Class     : List
26  * Author    : Gaurav Vaish
27  *
28  * Copyright : 2003 with Gaurav Vaish, and with
29  *             Ximian Inc
30  */
31
32 using System.Collections;
33 using System.Web.UI;
34 using System.Web.Mobile;
35
36 namespace System.Web.UI.MobileControls
37 {
38         public class List : PagedControl, INamingContainer, IListControl,
39                             ITemplateable, IPostBackEventHandler
40         {
41                 private static readonly object ItemDataBindEvent = new object();
42                 private static readonly object ItemCommandEvent  = new object();
43
44                 private ListDecoration decoration = ListDecoration.None;
45
46                 public List()
47                 {
48                 }
49
50                 public event ListCommandEventHandler ItemCommand
51                 {
52                         add
53                         {
54                                 Events.AddHandler(ItemCommandEvent, value);
55                         }
56                         remove
57                         {
58                                 Events.RemoveHandler(ItemCommandEvent, value);
59                         }
60                 }
61
62                 public event ListDataBindEventHandler ItemDataBind
63                 {
64                         add
65                         {
66                                 Events.AddHandler(ItemDataBindEvent, value);
67                         }
68                         remove
69                         {
70                                 Events.RemoveHandler(ItemDataBindEvent, value);
71                         }
72                 }
73
74                 private void CreateChildControls(bool doDataBind)
75                 {
76                         if(IsTemplated)
77                         {
78                                 throw new NotImplementedException();
79                         }
80                         ChildControlsCreated = true;
81                 }
82
83                 public virtual string DataMember
84                 {
85                         get
86                         {
87                                 throw new NotImplementedException();
88                         }
89                         set
90                         {
91                                 throw new NotImplementedException();
92                         }
93                 }
94
95                 public virtual object DataSource
96                 {
97                         get
98                         {
99                                 throw new NotImplementedException();
100                         }
101                         set
102                         {
103                                 throw new NotImplementedException();
104                         }
105                 }
106
107                 public string DataTextField
108                 {
109                         get
110                         {
111                                 throw new NotImplementedException();
112                         }
113                         set
114                         {
115                                 throw new NotImplementedException();
116                         }
117                 }
118
119                 public string DataValueField
120                 {
121                         get
122                         {
123                                 throw new NotImplementedException();
124                         }
125                         set
126                         {
127                                 throw new NotImplementedException();
128                         }
129                 }
130
131                 public ListDecoration Decoration
132                 {
133                         get
134                         {
135                                 return decoration;
136                         }
137                         set
138                         {
139                                 decoration = value;
140                         }
141                 }
142
143                 public bool HasItemCommandHandler
144                 {
145                         get
146                         {
147                                 return (Events[ItemCommandEvent] != null);
148                         }
149                 }
150
151                 protected override int InternalItemCount
152                 {
153                         get
154                         {
155                                 throw new NotImplementedException();
156                         }
157                 }
158
159                 public MobileListItemCollection Items
160                 {
161                         get
162                         {
163                                 throw new NotImplementedException();
164                         }
165                 }
166
167                 public bool ItemsAsLinks
168                 {
169                         get
170                         {
171                                 throw new NotImplementedException();
172                         }
173                         set
174                         {
175                                 throw new NotImplementedException();
176                         }
177                 }
178
179                 private void CreateControlItem(MobileListItemType itemType,
180                                         ITemplate itemTemplate, bool doDataBind)
181                 {
182                         // Create control.
183                         // Add control at the end of this "List".
184                         throw new NotImplementedException();
185                 }
186
187                 private int TranslateVirtualItemIndex(int itemIndex)
188                 {
189                         throw new NotImplementedException();
190                 }
191
192                 protected override void AddParsedSubObject(object obj)
193                 {
194                         if(obj is LiteralControl || obj is MobileControl)
195                         {
196                                 throw new NotImplementedException();
197                         }
198                 }
199
200                 protected override void CreateChildControls()
201                 {
202                         CreateChildControls(true);
203                 }
204
205                 protected virtual void CreateItems(IEnumerable dataSource)
206                 {
207                         throw new NotImplementedException();
208                 }
209
210                 protected override void LoadViewState(object state)
211                 {
212                         throw new NotImplementedException();
213                 }
214
215                 protected override bool OnBubbleEvent(object sender, EventArgs e)
216                 {
217                         if(e is ListCommandEventArgs)
218                         {
219                                 OnItemCommand((ListCommandEventArgs)e);
220                                 return true;
221                         }
222                         return false;
223                 }
224
225                 protected override void OnDataBinding(EventArgs e)
226                 {
227                         base.OnDataBinding(e);
228                         throw new NotImplementedException();
229                 }
230
231                 protected void OnItemDataBind(ListDataBindEventArgs e)
232                 {
233                         ListDataBindEventHandler ldbeh = (ListDataBindEventHandler)(Events[ItemDataBindEvent]);
234                         if(ldbeh != null)
235                                 ldbeh(this, e);
236                 }
237
238                 protected virtual void OnItemCommand(ListCommandEventArgs e)
239                 {
240                         ListCommandEventHandler lceh = (ListCommandEventHandler)(Events[ItemCommandEvent]);
241                         if(lceh != null)
242                                 lceh(this, e);
243                 }
244
245                 protected override void OnLoadItems(LoadItemsEventArgs e)
246                 {
247                         throw new NotImplementedException();
248                 }
249
250                 protected override void OnPageChange(int oldPageIndex,
251                                                      int newPageIndex)
252                 {
253                         base.OnPageChange(oldPageIndex, newPageIndex);
254                         throw new NotImplementedException();
255                 }
256
257                 protected override void OnPreRender(EventArgs e)
258                 {
259                         throw new NotImplementedException();
260                 }
261
262                 protected override object SaveViewState()
263                 {
264                         throw new NotImplementedException();
265                 }
266
267                 protected override void TrackViewState()
268                 {
269                         throw new NotImplementedException();
270                 }
271
272                 public override void CreateDefaultTemplatedUI(bool doDataBind)
273                 {
274                         throw new NotImplementedException();
275                 }
276
277                 public override void EnsureTemplatedUI()
278                 {
279                         EnsureChildControls();
280                 }
281
282                 void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
283                 {
284                         throw new NotImplementedException();
285                 }
286
287                 void IListControl.OnItemDataBind(ListDataBindEventArgs e)
288                 {
289                         OnItemDataBind(e);
290                 }
291
292                 bool IListControl.TrackingViewState
293                 {
294                         get
295                         {
296                                 return IsTrackingViewState;
297                         }
298                 }
299         }
300 }