| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- /**
- * Namespace: System.Web.UI.WebControls
- * Class: WebControl
- *
- * Author: Gaurav Vaish
- * Contact: <[email protected]>, <[email protected]>
- * Status: 15%??
- *
- * (C) Gaurav Vaish (2001)
- */
- using System;
- using System.Web;
- using System.Web.UI;
- using System.Drawing;
- using System.Collections.Specialized;
- namespace System.Web.UI.WebControls
- {
- public class WebControl : Control, IAttributeAccessor
- {
- //TODO: A list of private members may be incomplete
- private HtmlTextWriterTag writerTag;
- private string stringTag;
- private AttributesCollection attributes;
- private StateBag attributeState;
- private Style controlStyle;
- // TODO: The constructors definitions
- protected WebControl()
- {
- //todo: what now?
- controlStyle = null;
- }
-
- public WebControl(HtmlTextWriterTag tag)
- {
- //TODO: am i right?
- writerTag = tag;
- stringTag = null;
- controlStyle = null;
- }
- protected WebControl(string tag)
- {
- //TODO: am i right?
- stringTag = tag;
- writerTag = null;
- controlStyle = null;
- }
-
- public virtual string AccessKey
- {
- get
- {
- object o = ViewState["AccessKey"];
- if(o!=null)
- return (string)o;
- return String.Empty;
- }
- set
- {
- ViewState["AccessKey"] = value;
- }
- }
-
- public AttributeCollection Attributes
- {
- if(attributes==null)
- {
- //TODO: From where to get StateBag and how? I think this method is OK!
- if(attributeState == null)
- {
- attributeState = new StateBag(true);
- if(attributeState.IsTrackingViewState)
- {
- attributeState.TrackViewState();
- }
- }
- attributes = new AttributeCollection(attributes);
- }
- return attributes;
- }
-
- public Style ControlStyle
- {
- get
- {
- if(controlStyle == null)
- {
- controlStyle = CreateControlStyle();
- if(IsTrackingViewState)
- {
- controlStyle.TrackViewState();
- }
- controlStyle.LoadViewState(null);
- }
- return controlStyle;
- }
- }
-
- public bool ControlStyleCreated
- {
- get
- {
- return (controlStyle!=null);
- }
- }
-
- public virtual string CssClass
- {
- get
- {
- if(ControlStyleCreated)
- return controlStyle.CssClass;
- return String.Empty;
- }
- }
-
- public
-
- protected virtual Style CreateControlStyle()
- {
- return new Style(ViewState); // from parent class Control
- }
-
- // Implemented procedures
- public string GetAttribute(string key)
- {
- return "";
- }
-
- public void SetAttribute(string key, string val)
- {
- }
- }
- }
|