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