2 // System.Web.UI.WebControls.MenuItemBinding.cs
5 // Lluis Sanchez Gual (lluis@novell.com)
7 // (C) 2004 Novell, Inc (http://www.novell.com)
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
34 using System.Collections;
36 using System.ComponentModel;
38 namespace System.Web.UI.WebControls
40 [DefaultProperty ("TextField")]
41 public sealed class MenuItemBinding: IStateManager, ICloneable, IDataSourceViewSchemaAccessor
43 StateBag ViewState = new StateBag ();
46 public string DataMember {
48 object o = ViewState ["DataMember"];
49 if (o != null) return (string) o;
53 ViewState ["DataMember"] = value;
60 object o = ViewState ["Depth"];
61 if (o != null) return (int) o;
65 ViewState ["Depth"] = value;
72 object o = ViewState ["Enabled"];
73 if (o != null) return (bool) o;
77 ViewState ["Enabled"] = value;
82 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
83 public string EnabledField {
85 object o = ViewState ["EnabledField"];
86 if (o != null) return (string) o;
90 ViewState ["EnabledField"] = value;
96 public string FormatString {
98 object o = ViewState ["FormatString"];
99 if (o != null) return (string) o;
103 ViewState ["FormatString"] = value;
109 [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
110 public string ImageUrl {
112 object o = ViewState ["ImageUrl"];
113 if (o != null) return (string) o;
117 ViewState ["ImageUrl"] = value;
122 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
123 public string ImageUrlField {
125 object o = ViewState ["ImageUrlField"];
126 if (o != null) return (string) o;
130 ViewState ["ImageUrlField"] = value;
136 [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
137 public string NavigateUrl {
139 object o = ViewState ["NavigateUrl"];
140 if (o != null) return (string) o;
144 ViewState ["NavigateUrl"] = value;
149 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
150 public string NavigateUrlField {
152 object o = ViewState ["NavigateUrlField"];
153 if (o != null) return (string) o;
157 ViewState ["NavigateUrlField"] = value;
161 [DefaultValue (true)]
162 public bool Selectable {
164 object o = ViewState ["Selectable"];
165 if (o != null) return (bool) o;
169 ViewState ["Selectable"] = value;
174 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
175 public string SelectableField {
177 object o = ViewState ["SelectableField"];
178 if (o != null) return (string) o;
182 ViewState ["SelectableField"] = value;
187 public string Target {
189 object o = ViewState ["Target"];
190 if(o != null) return (string)o;
194 ViewState ["Target"] = value;
199 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
200 public string TargetField {
202 object o = ViewState ["TargetField"];
203 if (o != null) return (string) o;
207 ViewState ["TargetField"] = value;
213 [WebSysDescription ("The display text of the menu item.")]
216 object o = ViewState ["Text"];
217 if(o != null) return (string)o;
221 ViewState ["Text"] = value;
226 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
227 public string TextField {
229 object o = ViewState ["TextField"];
230 if(o != null) return (string)o;
234 ViewState ["TextField"] = value;
240 public string ToolTip {
242 object o = ViewState ["ToolTip"];
243 if(o != null) return (string)o;
247 ViewState ["ToolTip"] = value;
252 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
253 public string ToolTipField {
255 object o = ViewState ["ToolTipField"];
256 if(o != null) return (string)o;
260 ViewState ["ToolTipField"] = value;
266 public string Value {
268 object o = ViewState ["Value"];
269 if(o != null) return (string)o;
273 ViewState ["Value"] = value;
278 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
279 public string ValueField {
281 object o = ViewState ["ValueField"];
282 if(o != null) return (string)o;
286 ViewState ["ValueField"] = value;
292 [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
293 public string PopOutImageUrl {
295 object o = ViewState ["PopOutImageUrl"];
296 if (o != null) return (string) o;
300 ViewState ["PopOutImageUrl"] = value;
305 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
306 public string PopOutImageUrlField {
308 object o = ViewState ["PopOutImageUrlField"];
309 if(o != null) return (string)o;
313 ViewState ["PopOutImageUrlField"] = value;
319 [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
320 public string SeparatorImageUrl {
322 object o = ViewState ["SeparatorImageUrl"];
323 if (o != null) return (string) o;
327 ViewState ["SeparatorImageUrl"] = value;
332 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
333 public string SeparatorImageUrlField {
335 object o = ViewState ["SeparatorImageUrlField"];
336 if(o != null) return (string)o;
340 ViewState ["SeparatorImageUrlField"] = value;
344 void IStateManager.LoadViewState (object savedState)
346 ViewState.LoadViewState (savedState);
349 object IStateManager.SaveViewState ()
351 return ViewState.SaveViewState();
354 void IStateManager.TrackViewState ()
356 ViewState.TrackViewState ();
359 bool IStateManager.IsTrackingViewState {
360 get { return ViewState.IsTrackingViewState; }
363 [MonoTODO ("Not implemented")]
364 object IDataSourceViewSchemaAccessor.DataSourceViewSchema {
365 get { throw new NotImplementedException (); }
366 set { throw new NotImplementedException (); }
369 object ICloneable.Clone ()
371 MenuItemBinding bin = new MenuItemBinding ();
372 foreach (DictionaryEntry e in ViewState)
373 bin.ViewState [(string)e.Key] = e.Value;
377 internal void SetDirty ()
379 foreach (string key in ViewState.Keys)
380 ViewState.SetItemDirty (key, true);