📄 itemlook.cs
字号:
using System;
using System.Xml;
using System.Text;
using System.Collections;
using System.Diagnostics;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace ComponentArt.Web.UI
{
/// <summary>
/// Types of ItemLooks.
/// </summary>
internal enum ItemLookType
{
/// <summary>
/// Default look.
/// </summary>
Normal,
/// <summary>
/// Look to be used when the associated item is selected.
/// </summary>
Selected,
/// <summary>
/// Look to be used when one of associated item's descendants is selected.
/// </summary>
ChildSelected,
/// <summary>
/// Look to be used when the associated item is disabled.
/// </summary>
Disabled
}
/// <summary>
/// A set of look-related item properties which are used in conjunction with CSS definitions to define item’s look and feel.
/// </summary>
[ToolboxItem(false)]
[Browsable(false)]
public class ItemLook : ICloneable
{
#region Properties
private Hashtable m_oProperties;
internal bool FlatObject;
internal bool ForDefaultSubItem;
internal BaseMenuItem Item;
internal ItemLookType LookType;
private string _lookId;
/// <summary>
/// The ID of the look (or, in the case of a look translator, the last loaded look)
/// </summary>
[DefaultValue(null)]
public string LookId
{
get
{
if(FlatObject)
{
return _lookId;
}
else if(this.Item != null)
{
return this.GetProperty("LookId");
}
else
{
return (string)m_oProperties["LookId"];
}
}
set
{
if(FlatObject)
{
_lookId = value;
}
else if(this.Item != null)
{
this.SetProperty("LookId", value);
}
else
{
m_oProperties["LookId"] = value;
}
}
}
private Unit _labelPaddingBottom;
/// <summary>
/// The padding to apply to the bottom of the label.
/// </summary>
[DefaultValue(typeof(Unit),"")]
public Unit LabelPaddingBottom
{
get
{
if(FlatObject)
{
return _labelPaddingBottom;
}
else if (this.Item != null)
{
return Utils.ParseUnit(this.GetProperty("LabelPaddingBottom"));
}
else
{
return Utils.ParseUnit(m_oProperties["LabelPaddingBottom"]);
}
}
set
{
if(FlatObject)
{
_labelPaddingBottom = value;
}
else if(this.Item != null)
{
this.SetProperty("LabelPaddingBottom", value.ToString());
}
else
{
m_oProperties["LabelPaddingBottom"] = value.ToString();
}
}
}
private Unit _labelPaddingLeft;
/// <summary>
/// The padding to apply to the left of the label.
/// </summary>
[DefaultValue(typeof(Unit),"")]
public Unit LabelPaddingLeft
{
get
{
if(FlatObject)
{
return _labelPaddingLeft;
}
else if (this.Item != null)
{
return Utils.ParseUnit(this.GetProperty("LabelPaddingLeft"));
}
else
{
return Utils.ParseUnit(m_oProperties["LabelPaddingLeft"]);
}
}
set
{
if(FlatObject)
{
_labelPaddingLeft = value;
}
else if(this.Item != null)
{
this.SetProperty("LabelPaddingLeft", value.ToString());
}
else
{
m_oProperties["LabelPaddingLeft"] = value.ToString();
}
}
}
private Unit _labelPaddingRight;
/// <summary>
/// The padding to apply to the right of the label.
/// </summary>
[DefaultValue(typeof(Unit),"")]
public Unit LabelPaddingRight
{
get
{
if(FlatObject)
{
return _labelPaddingRight;
}
else if (this.Item != null)
{
return Utils.ParseUnit(this.GetProperty("LabelPaddingRight"));
}
else
{
return Utils.ParseUnit(m_oProperties["LabelPaddingRight"]);
}
}
set
{
if(FlatObject)
{
_labelPaddingRight = value;
}
else if(this.Item != null)
{
this.SetProperty("LabelPaddingRight", value.ToString());
}
else
{
m_oProperties["LabelPaddingRight"] = value.ToString();
}
}
}
private Unit _labelPaddingTop;
/// <summary>
/// The padding to apply to the top of the label.
/// </summary>
[DefaultValue(typeof(Unit),"")]
public Unit LabelPaddingTop
{
get
{
if(FlatObject)
{
return _labelPaddingTop;
}
else if (this.Item != null)
{
return Utils.ParseUnit(this.GetProperty("LabelPaddingTop"));
}
else
{
return Utils.ParseUnit(m_oProperties["LabelPaddingTop"]);
}
}
set
{
if(FlatObject)
{
_labelPaddingTop = value;
}
else if(this.Item != null)
{
this.SetProperty("LabelPaddingTop", value.ToString());
}
else
{
m_oProperties["LabelPaddingTop"] = value.ToString();
}
}
}
private string _cssClass;
/// <summary>
/// The CSS class to use.
/// </summary>
[DefaultValue(null)]
public string CssClass
{
get
{
if(FlatObject)
{
return _cssClass;
}
else if(this.Item != null)
{
return this.GetProperty("CssClass");
}
else
{
return (string)m_oProperties["CssClass"];
}
}
set
{
if(FlatObject)
{
_cssClass = value;
}
else if(this.Item != null)
{
this.SetProperty("CssClass", value);
}
else
{
m_oProperties["CssClass"] = value;
}
}
}
private Unit _leftIconHeight;
/// <summary>
/// The height of the left icon.
/// </summary>
[DefaultValue(typeof(Unit),"")]
public Unit LeftIconHeight
{
get
{
if(FlatObject)
{
return _leftIconHeight;
}
else if (this.Item != null)
{
return Utils.ParseUnit(this.GetProperty("LeftIconHeight"));
}
else
{
return Utils.ParseUnit(m_oProperties["LeftIconHeight"]);
}
}
set
{
if (value.Type == UnitType.Pixel)
{
if(FlatObject)
{
_leftIconHeight = value;
}
else if (this.Item != null)
{
this.SetProperty("LeftIconHeight", value.ToString());
}
else
{
m_oProperties["LeftIconHeight"] = value.ToString();
}
}
else
{
throw new Exception("Icon dimensions may only be specified in pixels.");
}
}
}
private string _leftIconUrl;
/// <summary>
/// The URL of the left icon to use in this look.
/// </summary>
[DefaultValue(null)]
public string LeftIconUrl
{
get
{
if(FlatObject)
{
return _leftIconUrl;
}
else if(this.Item != null)
{
return this.GetProperty("LeftIconUrl");
}
else
{
return (string)m_oProperties["LeftIconUrl"];
}
}
set
{
if(FlatObject)
{
_leftIconUrl = value;
}
else if(this.Item != null)
{
this.SetProperty("LeftIconUrl", value);
}
else
{
m_oProperties["LeftIconUrl"] = value;
}
}
}
private Unit _leftIconWidth;
/// <summary>
/// The width of the left icon.
/// </summary>
[DefaultValue(typeof(Unit),"")]
public Unit LeftIconWidth
{
get
{
if(FlatObject)
{
return _leftIconWidth;
}
else if (this.Item != null)
{
return Utils.ParseUnit(this.GetProperty("LeftIconWidth"));
}
else
{
return Utils.ParseUnit(m_oProperties["LeftIconWidth"]);
}
}
set
{
if (value.Type == UnitType.Pixel)
{
if(FlatObject)
{
_leftIconWidth = value;
}
else if (this.Item != null)
{
this.SetProperty("LeftIconWidth", value.ToString());
}
else
{
m_oProperties["LeftIconWidth"] = value.ToString();
}
}
else
{
throw new Exception("Icon dimensions may only be specified in pixels.");
}
}
}
private Unit _rightIconHeight;
/// <summary>
/// The height of the right icon.
/// </summary>
[DefaultValue(typeof(Unit),"")]
public Unit RightIconHeight
{
get
{
if(FlatObject)
{
return _rightIconHeight;
}
else if (this.Item != null)
{
return Utils.ParseUnit(this.GetProperty("RightIconHeight"));
}
else
{
return Utils.ParseUnit(m_oProperties["RightIconHeight"]);
}
}
set
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -