HotSpot.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. //
  2. // System.Web.UI.WebControls.HotSpot.cs
  3. //
  4. // Authors:
  5. // Lluis Sanchez Gual ([email protected])
  6. //
  7. // (C) 2005 Novell, Inc (http://www.novell.com)
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. #if NET_2_0
  30. using System.ComponentModel;
  31. using System.Security.Permissions;
  32. namespace System.Web.UI.WebControls
  33. {
  34. [TypeConverterAttribute (typeof(ExpandableObjectConverter))]
  35. [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  36. [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  37. public abstract class HotSpot: IStateManager
  38. {
  39. StateBag viewState = new StateBag ();
  40. [LocalizableAttribute (true)]
  41. [DefaultValueAttribute ("")]
  42. public virtual string AccessKey {
  43. get {
  44. object o = viewState ["AccessKey"];
  45. return o != null ? (string) o : "";
  46. }
  47. set {
  48. viewState ["AccessKey"] = value;
  49. }
  50. }
  51. [LocalizableAttribute (true)]
  52. [NotifyParentPropertyAttribute (true)]
  53. [WebCategoryAttribute ("Behavior")]
  54. [DefaultValueAttribute ("")]
  55. [BindableAttribute (true)]
  56. public virtual string AlternateText {
  57. get {
  58. object o = viewState ["AlternateText"];
  59. return o != null ? (string) o : "";
  60. }
  61. set {
  62. viewState ["AlternateText"] = value;
  63. }
  64. }
  65. [WebCategoryAttribute ("Behavior")]
  66. [DefaultValueAttribute (HotSpotMode.NotSet)]
  67. [NotifyParentPropertyAttribute (true)]
  68. public virtual HotSpotMode HotSpotMode {
  69. get {
  70. object o = viewState ["HotSpotMode"];
  71. return o != null ? (HotSpotMode) o : HotSpotMode.NotSet;
  72. }
  73. set {
  74. viewState ["HotSpotMode"] = value;
  75. }
  76. }
  77. [DefaultValueAttribute ("")]
  78. [BindableAttribute (true)]
  79. [EditorAttribute ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
  80. [NotifyParentPropertyAttribute (true)]
  81. [UrlPropertyAttribute]
  82. public string NavigateUrl {
  83. get {
  84. object o = viewState ["NavigateUrl"];
  85. return o != null ? (string) o : "";
  86. }
  87. set {
  88. viewState ["NavigateUrl"] = value;
  89. }
  90. }
  91. [BindableAttribute (true)]
  92. [WebCategoryAttribute ("Behavior")]
  93. [DefaultValueAttribute ("")]
  94. [NotifyParentPropertyAttribute (true)]
  95. public string PostBackValue {
  96. get {
  97. object o = viewState ["PostBackValue"];
  98. return o != null ? (string) o : "";
  99. }
  100. set {
  101. viewState ["PostBackValue"] = value;
  102. }
  103. }
  104. [DefaultValueAttribute ((short)0)]
  105. [WebCategoryAttribute ("Accessibility")]
  106. public virtual short TabIndex {
  107. get {
  108. object o = viewState ["TabIndex"];
  109. return o != null ? (short) o : (short) 0;
  110. }
  111. set {
  112. viewState ["TabIndex"] = value;
  113. }
  114. }
  115. [WebCategoryAttribute ("Behavior")]
  116. [NotifyParentPropertyAttribute (true)]
  117. [DefaultValueAttribute ("")]
  118. [TypeConverterAttribute (typeof(TargetConverter))]
  119. public virtual string Target {
  120. get {
  121. object o = viewState ["Target"];
  122. return o != null ? (string) o : "";
  123. }
  124. set {
  125. viewState ["Target"] = value;
  126. }
  127. }
  128. [Browsable (false)]
  129. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  130. protected StateBag ViewState {
  131. get { return viewState; }
  132. }
  133. protected virtual void LoadViewState (object savedState)
  134. {
  135. viewState.LoadViewState (savedState);
  136. }
  137. protected virtual object SaveViewState ()
  138. {
  139. return viewState.SaveViewState ();
  140. }
  141. protected virtual void TrackViewState ()
  142. {
  143. viewState.TrackViewState ();
  144. }
  145. protected virtual bool IsTrackingViewState
  146. {
  147. get { return viewState.IsTrackingViewState; }
  148. }
  149. void IStateManager.LoadViewState (object savedState)
  150. {
  151. LoadViewState (savedState);
  152. }
  153. object IStateManager.SaveViewState ()
  154. {
  155. return SaveViewState ();
  156. }
  157. void IStateManager.TrackViewState ()
  158. {
  159. TrackViewState ();
  160. }
  161. bool IStateManager.IsTrackingViewState
  162. {
  163. get { return IsTrackingViewState; }
  164. }
  165. public override string ToString ()
  166. {
  167. return GetType().Name;
  168. }
  169. internal void SetDirty ()
  170. {
  171. viewState.SetDirty (true);
  172. }
  173. public abstract string GetCoordinates ();
  174. protected internal abstract string MarkupName { get; }
  175. }
  176. }
  177. #endif