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))]
\r
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)]
\r
46 [DefaultValueAttribute ("")]
\r
47 public virtual string AccessKey {
49 object o = viewState ["AccessKey"];
50 return o != null ? (string) o : "";
53 viewState ["AccessKey"] = value;
57 [NotifyParentPropertyAttribute (true)]
\r
58 [WebCategoryAttribute ("Behavior")]
\r
59 [DefaultValueAttribute ("")]
\r
60 [BindableAttribute (true)]
\r
61 public virtual string AlternateText {
63 object o = viewState ["AlternateText"];
64 return o != null ? (string) o : "";
67 viewState ["AlternateText"] = value;
71 [WebCategoryAttribute ("Behavior")]
\r
72 [DefaultValueAttribute (HotSpotMode.NotSet)]
\r
73 [NotifyParentPropertyAttribute (true)]
\r
74 public virtual HotSpotMode HotSpotMode {
76 object o = viewState ["HotSpotMode"];
77 return o != null ? (HotSpotMode) o : HotSpotMode.NotSet;
80 viewState ["HotSpotMode"] = value;
84 [DefaultValueAttribute ("")]
\r
85 [BindableAttribute (true)]
\r
86 [EditorAttribute ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
\r
87 [NotifyParentPropertyAttribute (true)]
\r
88 [UrlPropertyAttribute]
\r
89 public virtual string NavigateUrl {
91 object o = viewState ["NavigateUrl"];
92 return o != null ? (string) o : "";
95 viewState ["NavigateUrl"] = value;
99 [BindableAttribute (true)]
\r
100 [WebCategoryAttribute ("Behavior")]
\r
101 [DefaultValueAttribute ("")]
\r
102 [NotifyParentPropertyAttribute (true)]
\r
103 public virtual string PostBackValue {
105 object o = viewState ["PostBackValue"];
106 return o != null ? (string) o : "";
109 viewState ["PostBackValue"] = value;
113 [DefaultValueAttribute ((short)0)]
\r
114 [WebCategoryAttribute ("Accessibility")]
\r
115 public virtual short TabIndex {
117 object o = viewState ["TabIndex"];
118 return o != null ? (short) o : (short) 0;
121 viewState ["TabIndex"] = value;
125 [WebCategoryAttribute ("Behavior")]
\r
126 [NotifyParentPropertyAttribute (true)]
\r
127 [DefaultValueAttribute ("")]
\r
128 [TypeConverterAttribute (typeof(TargetConverter))]
\r
129 public virtual string Target {
131 object o = viewState ["Target"];
132 return o != null ? (string) o : "";
135 viewState ["Target"] = value;
140 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
141 protected StateBag ViewState {
142 get { return viewState; }
145 protected virtual void LoadViewState (object savedState)
147 viewState.LoadViewState (savedState);
150 protected virtual object SaveViewState ()
152 return viewState.SaveViewState ();
155 protected virtual void TrackViewState ()
157 viewState.TrackViewState ();
160 protected virtual bool IsTrackingViewState
162 get { return viewState.IsTrackingViewState; }
165 void IStateManager.LoadViewState (object savedState)
167 LoadViewState (savedState);
170 object IStateManager.SaveViewState ()
172 return SaveViewState ();
175 void IStateManager.TrackViewState ()
180 bool IStateManager.IsTrackingViewState
182 get { return IsTrackingViewState; }
185 public override string ToString ()
187 return GetType().Name;
190 internal void SetDirty ()
192 viewState.SetDirty (true);
195 public abstract string GetCoordinates ();
197 protected internal abstract string MarkupName { get; }