2 // System.Web.UI.WebControls.HotSpot.cs
5 // Lluis Sanchez Gual (lluis@novell.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.ComponentModel;
34 using System.Security.Permissions;
36 namespace System.Web.UI.WebControls
38 [TypeConverterAttribute (typeof(ExpandableObjectConverter))]
39 [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
40 [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
41 public abstract class HotSpot: IStateManager
43 StateBag viewState = new StateBag ();
45 [LocalizableAttribute (true)]
46 [DefaultValueAttribute ("")]
47 public virtual string AccessKey {
49 object o = viewState ["AccessKey"];
50 return o != null ? (string) o : "";
53 viewState ["AccessKey"] = value;
57 [LocalizableAttribute (true)]
58 [NotifyParentPropertyAttribute (true)]
59 [WebCategoryAttribute ("Behavior")]
60 [DefaultValueAttribute ("")]
61 [BindableAttribute (true)]
62 public virtual string AlternateText {
64 object o = viewState ["AlternateText"];
65 return o != null ? (string) o : "";
68 viewState ["AlternateText"] = value;
72 [WebCategoryAttribute ("Behavior")]
73 [DefaultValueAttribute (HotSpotMode.NotSet)]
74 [NotifyParentPropertyAttribute (true)]
75 public virtual HotSpotMode HotSpotMode {
77 object o = viewState ["HotSpotMode"];
78 return o != null ? (HotSpotMode) o : HotSpotMode.NotSet;
81 viewState ["HotSpotMode"] = value;
85 [DefaultValueAttribute ("")]
86 [BindableAttribute (true)]
87 [EditorAttribute ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
88 [NotifyParentPropertyAttribute (true)]
89 [UrlPropertyAttribute]
90 public string NavigateUrl {
92 object o = viewState ["NavigateUrl"];
93 return o != null ? (string) o : "";
96 viewState ["NavigateUrl"] = value;
100 [BindableAttribute (true)]
101 [WebCategoryAttribute ("Behavior")]
102 [DefaultValueAttribute ("")]
103 [NotifyParentPropertyAttribute (true)]
104 public string PostBackValue {
106 object o = viewState ["PostBackValue"];
107 return o != null ? (string) o : "";
110 viewState ["PostBackValue"] = value;
114 [DefaultValueAttribute ((short)0)]
115 [WebCategoryAttribute ("Accessibility")]
116 public virtual short TabIndex {
118 object o = viewState ["TabIndex"];
119 return o != null ? (short) o : (short) 0;
122 viewState ["TabIndex"] = value;
126 [WebCategoryAttribute ("Behavior")]
127 [NotifyParentPropertyAttribute (true)]
128 [DefaultValueAttribute ("")]
129 [TypeConverterAttribute (typeof(TargetConverter))]
130 public virtual string Target {
132 object o = viewState ["Target"];
133 return o != null ? (string) o : "";
136 viewState ["Target"] = value;
141 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
142 protected StateBag ViewState {
143 get { return viewState; }
146 protected virtual void LoadViewState (object savedState)
148 viewState.LoadViewState (savedState);
151 protected virtual object SaveViewState ()
153 return viewState.SaveViewState ();
156 protected virtual void TrackViewState ()
158 viewState.TrackViewState ();
161 protected virtual bool IsTrackingViewState
163 get { return viewState.IsTrackingViewState; }
166 void IStateManager.LoadViewState (object savedState)
168 LoadViewState (savedState);
171 object IStateManager.SaveViewState ()
173 return SaveViewState ();
176 void IStateManager.TrackViewState ()
181 bool IStateManager.IsTrackingViewState
183 get { return IsTrackingViewState; }
186 public override string ToString ()
188 return GetType().Name;
191 internal void SetDirty ()
193 viewState.SetDirty (true);
196 public abstract string GetCoordinates ();
198 protected internal abstract string MarkupName { get; }