WebControl.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: WebControl
  4. *
  5. * Author: Gaurav Vaish
  6. * Contact: <[email protected]>, <[email protected]>
  7. * Status: Unknown %
  8. *
  9. * (C) Gaurav Vaish (2001)
  10. */
  11. using System;
  12. using System.Web;
  13. using System.Web.UI;
  14. using System.Drawing;
  15. using System.Collections.Specialized;
  16. namespace System.Web.UI.WebControls
  17. {
  18. public class WebControl : Control, IAttributeAccessor
  19. {
  20. //TODO: A list of private members may be incomplete
  21. private static int i = 0;
  22. private string _accessKey = string.Empty;
  23. private string _clientID;
  24. private Color _backColor = Color.Empty;
  25. private Color _borderColor = Color.Empty;
  26. private BorderStyle _bStyle;
  27. private Unit _borderWidth = Unit.Empty;
  28. private Style _controlStyle = null; //TODO: What's initial value?
  29. private string _cssClass = string.Empty;
  30. private bool _enabled = true;
  31. private FontInfo _font;
  32. // TODO: Should this have other methods called? or
  33. // the values should be left blank - to be used up by the end-user?
  34. private AttributeCollection _attributes = new AttributeCollection( new System.Web.UI.StateBag());
  35. public virtual string AccessKey
  36. {
  37. get
  38. {
  39. return _accessKey;
  40. }
  41. set
  42. {
  43. _accessKey = value;
  44. }
  45. }
  46. public virtual AttributeCollection Attributes
  47. {
  48. get
  49. {
  50. return _attributes;
  51. }
  52. }
  53. public virtual Color BackColor
  54. {
  55. get
  56. {
  57. return _backColor;
  58. }
  59. set
  60. {
  61. _backColor = value;
  62. }
  63. }
  64. public virtual Color BorderColor
  65. {
  66. get
  67. {
  68. return _borderColor;
  69. }
  70. set
  71. {
  72. _borderColor = value;
  73. }
  74. }
  75. // TODO: Confused with the enum BorderStyle and variable BorderStyle
  76. //public virtual BorderStyle BorderStyle { get; set; }
  77. public virtual Unit BorderWidth
  78. {
  79. get
  80. {
  81. return _borderWidth;
  82. }
  83. set
  84. {
  85. _borderWidth = value;
  86. }
  87. }
  88. public override string ClientID
  89. {
  90. get
  91. {
  92. _clientID = "WebControl" + i++;
  93. return _clientID;
  94. }
  95. }
  96. public Style ControlStyle
  97. {
  98. get
  99. {
  100. return _controlStyle;
  101. }
  102. }
  103. // TODO: The exact purpose of the field is not known
  104. // public bool ControlStyleCreated { get; }
  105. public virtual string CssClass
  106. {
  107. get
  108. {
  109. return _cssClass;
  110. }
  111. set
  112. {
  113. _cssClass = value;
  114. }
  115. }
  116. public virtual bool Enabled
  117. {
  118. get
  119. {
  120. return _enabled;
  121. }
  122. set
  123. {
  124. _enabled = value;
  125. }
  126. }
  127. public virtual FontInfo Font
  128. {
  129. get
  130. {
  131. return _font;
  132. }
  133. }
  134. // TODO: The constructors definitions
  135. protected WebControl()
  136. {
  137. }
  138. public WebControl(HtmlTextWriterTag tag)
  139. {
  140. }
  141. protected WebControl(string tag)
  142. {
  143. }
  144. // Implemented procedures
  145. public string GetAttribute(string key)
  146. {
  147. return "";
  148. }
  149. public void SetAttribute(string key, string val)
  150. {
  151. }
  152. /*
  153. // Properties
  154. public ControlCollection Controls { virtual get; }
  155. public Style ControlStyle { get; }
  156. public bool ControlStyleCreated { get; }
  157. public bool EnableViewState { virtual get; virtual set; }
  158. public FontInfo Font { virtual get; }
  159. public Color ForeColor { virtual get; virtual set; }
  160. public Unit Height { virtual get; virtual set; }
  161. public string ID { virtual get; virtual set; }
  162. public Control NamingContainer { virtual get; }
  163. public Page Page { virtual get; virtual set; }
  164. public Control Parent { virtual get; }
  165. public ISite Site { virtual get; virtual set; }
  166. public CssStyleCollection Style { get; }
  167. public short TabIndex { virtual get; virtual set; }
  168. public string TemplateSourceDirectory { virtual get; }
  169. public string ToolTip { virtual get; virtual set; }
  170. public string UniqueID { virtual get; }
  171. public bool Visible { virtual get; virtual set; }
  172. public Unit Width { virtual get; virtual set; }
  173. // Events
  174. public event EventHandler DataBinding;
  175. public event EventHandler Disposed;
  176. public event EventHandler Init;
  177. public event EventHandler Load;
  178. public event EventHandler PreRender;
  179. public event EventHandler Unload;
  180. // Methods
  181. public void ApplyStyle(System.Web.UI.WebControls.Style s);
  182. public void CopyBaseAttributes(System.Web.UI.WebControls.WebControl controlSrc);
  183. public virtual void DataBind();
  184. public virtual void Dispose();
  185. public virtual bool Equals(object obj);
  186. public virtual System.Web.UI.Control FindControl(string id);
  187. public virtual int GetHashCode();
  188. public Type GetType();
  189. public virtual bool HasControls();
  190. public void MergeStyle(System.Web.UI.WebControls.Style s);
  191. public virtual void RenderBeginTag(System.Web.UI.HtmlTextWriter writer);
  192. public void RenderControl(System.Web.UI.HtmlTextWriter writer);
  193. public virtual void RenderEndTag(System.Web.UI.HtmlTextWriter writer);
  194. public string ResolveUrl(string relativeUrl);
  195. public void SetRenderMethodDelegate(System.Web.UI.RenderMethod renderMethod);
  196. public virtual string ToString();
  197. //*/
  198. }
  199. }