HotSpot.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. [NotifyParentPropertyAttribute (true)]
  52. [WebCategoryAttribute ("Behavior")]
  53. [DefaultValueAttribute ("")]
  54. [BindableAttribute (true)]
  55. public virtual string AlternateText {
  56. get {
  57. object o = viewState ["AlternateText"];
  58. return o != null ? (string) o : "";
  59. }
  60. set {
  61. viewState ["AlternateText"] = value;
  62. }
  63. }
  64. [WebCategoryAttribute ("Behavior")]
  65. [DefaultValueAttribute (HotSpotMode.NotSet)]
  66. [NotifyParentPropertyAttribute (true)]
  67. public virtual HotSpotMode HotSpotMode {
  68. get {
  69. object o = viewState ["HotSpotMode"];
  70. return o != null ? (HotSpotMode) o : HotSpotMode.NotSet;
  71. }
  72. set {
  73. viewState ["HotSpotMode"] = value;
  74. }
  75. }
  76. [DefaultValueAttribute ("")]
  77. [BindableAttribute (true)]
  78. [EditorAttribute ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
  79. [NotifyParentPropertyAttribute (true)]
  80. [UrlPropertyAttribute]
  81. public virtual string NavigateUrl {
  82. get {
  83. object o = viewState ["NavigateUrl"];
  84. return o != null ? (string) o : "";
  85. }
  86. set {
  87. viewState ["NavigateUrl"] = value;
  88. }
  89. }
  90. [BindableAttribute (true)]
  91. [WebCategoryAttribute ("Behavior")]
  92. [DefaultValueAttribute ("")]
  93. [NotifyParentPropertyAttribute (true)]
  94. public virtual string PostBackValue {
  95. get {
  96. object o = viewState ["PostBackValue"];
  97. return o != null ? (string) o : "";
  98. }
  99. set {
  100. viewState ["PostBackValue"] = value;
  101. }
  102. }
  103. [DefaultValueAttribute (0)]
  104. [WebCategoryAttribute ("Accessibility")]
  105. public virtual short TabIndex {
  106. get {
  107. object o = viewState ["TabIndex"];
  108. return o != null ? (short) o : (short) 0;
  109. }
  110. set {
  111. viewState ["TabIndex"] = value;
  112. }
  113. }
  114. [WebCategoryAttribute ("Behavior")]
  115. [NotifyParentPropertyAttribute (true)]
  116. [DefaultValueAttribute ("")]
  117. [TypeConverterAttribute (typeof(TargetConverter))]
  118. public virtual string Target {
  119. get {
  120. object o = viewState ["Target"];
  121. return o != null ? (string) o : "";
  122. }
  123. set {
  124. viewState ["Target"] = value;
  125. }
  126. }
  127. [Browsable (false)]
  128. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  129. protected StateBag ViewState {
  130. get { return viewState; }
  131. }
  132. protected virtual void LoadViewState (object savedState)
  133. {
  134. viewState.LoadViewState (savedState);
  135. }
  136. protected virtual object SaveViewState ()
  137. {
  138. return viewState.SaveViewState ();
  139. }
  140. protected virtual void TrackViewState ()
  141. {
  142. viewState.TrackViewState ();
  143. }
  144. protected virtual bool IsTrackingViewState
  145. {
  146. get { return viewState.IsTrackingViewState; }
  147. }
  148. void IStateManager.LoadViewState (object savedState)
  149. {
  150. LoadViewState (savedState);
  151. }
  152. object IStateManager.SaveViewState ()
  153. {
  154. return SaveViewState ();
  155. }
  156. void IStateManager.TrackViewState ()
  157. {
  158. TrackViewState ();
  159. }
  160. bool IStateManager.IsTrackingViewState
  161. {
  162. get { return IsTrackingViewState; }
  163. }
  164. public override string ToString ()
  165. {
  166. return GetType().Name;
  167. }
  168. internal void SetDirty ()
  169. {
  170. viewState.SetDirty ();
  171. }
  172. public abstract string GetCoordinates ();
  173. protected internal abstract string MarkupName { get; }
  174. }
  175. }
  176. #endif