Files
mono/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
T
Gaurav Vaish d55f22bcd9 Added files:
CalendarDay.cs
	CheckBox.cs
	DayRenderEventHandler.cs

Changing:
	WebControl.cs

svn path=/trunk/mcs/; revision=1276
2001-11-06 17:43:44 +00:00

140 lines
2.6 KiB
C#
Executable File

/**
* 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)
{
}
}
}