corrected rendering: styles are applied correct
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / HotSpot.cs
1 //
2 // System.Web.UI.WebControls.HotSpot.cs
3 //
4 // Authors:
5 //      Lluis Sanchez Gual (lluis@novell.com)
6 //
7 // (C) 2005 Novell, Inc (http://www.novell.com)
8 //
9
10 //
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:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
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.
29 //
30
31 #if NET_2_0
32
33 using System.ComponentModel;
34 using System.Security.Permissions;
35
36 namespace System.Web.UI.WebControls
37 {
38         [TypeConverterAttribute (typeof(ExpandableObjectConverter))]
39         [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
40         [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
41         public abstract class HotSpot: IStateManager
42         {
43                 StateBag viewState = new StateBag ();
44                 
45                 [LocalizableAttribute (true)]
46                 [DefaultValueAttribute ("")]
47                 public virtual string AccessKey {
48                         get {
49                                 object o = viewState ["AccessKey"];
50                                 return o != null ? (string) o : "";
51                         }
52                         set {
53                                 viewState ["AccessKey"] = value;
54                         }
55                 }
56                 
57                 [LocalizableAttribute (true)]
58                 [NotifyParentPropertyAttribute (true)]
59                 [WebCategoryAttribute ("Behavior")]
60                 [DefaultValueAttribute ("")]
61                 [BindableAttribute (true)]
62                 public virtual string AlternateText {
63                         get {
64                                 object o = viewState ["AlternateText"];
65                                 return o != null ? (string) o : "";
66                         }
67                         set {
68                                 viewState ["AlternateText"] = value;
69                         }
70                 }
71                 
72                 [WebCategoryAttribute ("Behavior")]
73                 [DefaultValueAttribute (HotSpotMode.NotSet)]
74                 [NotifyParentPropertyAttribute (true)]
75                 public virtual HotSpotMode HotSpotMode {
76                         get {
77                                 object o = viewState ["HotSpotMode"];
78                                 return o != null ? (HotSpotMode) o : HotSpotMode.NotSet;
79                         }
80                         set {
81                                 viewState ["HotSpotMode"] = value;
82                         }
83                 }
84                 
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 {
91                         get {
92                                 object o = viewState ["NavigateUrl"];
93                                 return o != null ? (string) o : "";
94                         }
95                         set {
96                                 viewState ["NavigateUrl"] = value;
97                         }
98                 }
99                 
100                 [BindableAttribute (true)]
101                 [WebCategoryAttribute ("Behavior")]
102                 [DefaultValueAttribute ("")]
103                 [NotifyParentPropertyAttribute (true)]
104                 public string PostBackValue {
105                         get {
106                                 object o = viewState ["PostBackValue"];
107                                 return o != null ? (string) o : "";
108                         }
109                         set {
110                                 viewState ["PostBackValue"] = value;
111                         }
112                 }
113                 
114                 [DefaultValueAttribute ((short)0)]
115                 [WebCategoryAttribute ("Accessibility")]
116                 public virtual short TabIndex {
117                         get {
118                                 object o = viewState ["TabIndex"];
119                                 return o != null ? (short) o : (short) 0;
120                         }
121                         set {
122                                 viewState ["TabIndex"] = value;
123                         }
124                 }
125                 
126                 [WebCategoryAttribute ("Behavior")]
127                 [NotifyParentPropertyAttribute (true)]
128                 [DefaultValueAttribute ("")]
129                 [TypeConverterAttribute (typeof(TargetConverter))]
130                 public virtual string Target {
131                         get {
132                                 object o = viewState ["Target"];
133                                 return o != null ? (string) o : "";
134                         }
135                         set {
136                                 viewState ["Target"] = value;
137                         }
138                 }
139                 
140                 [Browsable (false)]
141                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
142                 protected StateBag ViewState {
143                         get { return viewState; }
144                 } 
145                 
146                 protected virtual void LoadViewState (object savedState)
147                 {
148                         viewState.LoadViewState (savedState);
149                 }
150                 
151                 protected virtual object SaveViewState ()
152                 {
153                         return viewState.SaveViewState ();
154                 }
155                 
156                 protected virtual void TrackViewState ()
157                 {
158                         viewState.TrackViewState ();
159                 }
160                 
161                 protected virtual bool IsTrackingViewState
162                 {
163                         get { return viewState.IsTrackingViewState; }
164                 }
165         
166                 void IStateManager.LoadViewState (object savedState)
167                 {
168                         LoadViewState (savedState);
169                 }
170                 
171                 object IStateManager.SaveViewState ()
172                 {
173                         return SaveViewState ();
174                 }
175                 
176                 void IStateManager.TrackViewState ()
177                 {
178                         TrackViewState ();
179                 }
180                 
181                 bool IStateManager.IsTrackingViewState
182                 {
183                         get { return IsTrackingViewState; }
184                 }
185                 
186                 public override string ToString ()
187                 {
188                         return GetType().Name;
189                 }
190                 
191                 internal void SetDirty ()
192                 {
193                         viewState.SetDirty (true);
194                 }
195         
196                 public abstract string GetCoordinates ();
197                 
198                 protected internal abstract string MarkupName { get; }
199         }
200 }
201
202 #endif