⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basemenuitem.cs

📁 ComponentArt Web.UI 2006.1252 for asp.net2.0
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;


namespace ComponentArt.Web.UI
{
	/// <summary>
	/// Navigation node class for BaseMenu. 
	/// </summary>
	public abstract class BaseMenuItem : NavigationNode
	{
		internal bool m_bLooksApplied = false;

    #region Public Properties

    #region Look Translators
    
		private ItemLook translator;

		private ItemLook GetTranslator()
		{
      if(translator == null)
      {
        translator = new ItemLook(true);
        translator.Item = this;
      }

      return translator;
		}
       
    #endregion

    /// <summary>
		/// The look to use for this item when a descendant is selected.
		/// </summary>
		/// <seealso cref="Look" />
		[Description("The look to use for this item when a descendant is selected.")]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public ItemLook ChildSelectedLook
		{
      get
      {
        ItemLook lookTranslator = GetTranslator();
        lookTranslator.ForDefaultSubItem = false;
        lookTranslator.LookType = ItemLookType.ChildSelected;
        return lookTranslator;
      }
			set
			{
				if(value != null)
				{
					ItemLook lookTranslator = GetTranslator();
					lookTranslator.ForDefaultSubItem = false;
					lookTranslator.LookType = ItemLookType.ChildSelected;
					value.CopyTo(lookTranslator, !m_bLooksApplied);
				}
			}
		}

		/// <summary>
		/// The ID of the pre-defined look to use for this item when a descendant is selected.
		/// </summary>
		[Category("ItemLook")]
		[DefaultValue(null)]
		[Description("The ID of the pre-defined look to use for this item when a descendant is selected.")]
		public string ChildSelectedLookId
		{
			get 
			{
				return Properties[GetAttributeVarName("ChildSelectedLookId")]; 
			}
			set 
			{
				Properties[GetAttributeVarName("ChildSelectedLookId")] = value;
			}
		}

		/// <summary>
		/// Default CSS class to apply to sub-groups below this item, including this item's subgroup.
		/// </summary>
		[Category("Appearance")]
		[Description("Default CSS class to apply to sub-groups below this item, including this item's subgroup.")]
		public string DefaultSubGroupCssClass
		{
			get 
			{
				string o = this.Properties[GetAttributeVarName("DefaultSubGroupCssClass")];
				return (o != null) ? o :
					(this.ParentItem != null) ? this.ParentItem.DefaultSubGroupCssClass :
					this.ParentBaseMenu.DefaultGroupCssClass;
			}
			set 
			{
				Properties[GetAttributeVarName("DefaultSubGroupCssClass")] = value;
			}
		}

    #region DefaultSubItem...

    private ItemLook _defaultSubItemChildSelectedLook;
		/// <summary>
		/// The default look to use for sub-items when their descendant is selected.
		/// </summary>
    /// <seealso cref="Look" />
    [Description("The default look to use for sub-items when their descendant is selected.")]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public ItemLook DefaultSubItemChildSelectedLook
		{
			get
			{
        if(_defaultSubItemChildSelectedLook != null)
        {
          return _defaultSubItemChildSelectedLook;
        }
        else
        {
          ItemLook lookTranslator = GetTranslator();
          lookTranslator.ForDefaultSubItem = true;
          lookTranslator.LookType = ItemLookType.ChildSelected;
          return lookTranslator;
        }
			}
			set
			{
				if(value != null)
				{
					ItemLook lookTranslator = GetTranslator();
					lookTranslator.ForDefaultSubItem = true;
					lookTranslator.LookType = ItemLookType.ChildSelected;
					value.CopyTo(lookTranslator, !m_bLooksApplied);
				}
			}
		}

		/// <summary>
		/// The ID of the pre-defined default look to use for sub-items when their descendant is selected.
		/// </summary>
		[Category("ItemLook")]
		[DefaultValue(null)]
		[Description("The ID of the pre-defined default look to use for sub-items when their descendant is selected.")]
		public string DefaultSubItemChildSelectedLookId
		{
			get 
			{
				return Properties[GetAttributeVarName("DefaultSubItemChildSelectedLookId")]; 
			}
			set 
			{
				Properties[GetAttributeVarName("DefaultSubItemChildSelectedLookId")] = value;
			}
		}

    private ItemLook _defaultSubItemDisabledLook;
		/// <summary>
		/// The default look to use for sub-items when they are disabled.
		/// </summary>
    /// <seealso cref="Look" />
    [Description("The default look to use for sub-items when they are disabled.")]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public ItemLook DefaultSubItemDisabledLook
		{
			get
			{
        if(_defaultSubItemDisabledLook != null)
        {
          return _defaultSubItemDisabledLook;
        }
        else
        {
          ItemLook lookTranslator = GetTranslator();
          lookTranslator.ForDefaultSubItem = true;
          lookTranslator.LookType = ItemLookType.Disabled;
          return lookTranslator;
        }
			}
			set
			{
				if(value != null)
				{
					ItemLook lookTranslator = GetTranslator();
					lookTranslator.ForDefaultSubItem = true;
					lookTranslator.LookType = ItemLookType.Disabled;
					value.CopyTo(lookTranslator, !m_bLooksApplied);
				}
			}
		}

		/// <summary>
		/// The ID of the pre-defined default look to use for sub-items when they are disabled.
		/// </summary>
		[Category("ItemLook")]
		[DefaultValue(null)]
		[Description("The ID of the pre-defined default look to use for sub-items when they are disabled.")]
		public string DefaultSubItemDisabledLookId
		{
			get 
			{
				return Properties[GetAttributeVarName("DefaultSubItemDisabledLookId")]; 
         
			}
			set 
			{
				Properties[GetAttributeVarName("DefaultSubItemDisabledLookId")] = value;
			}
		}

    private ItemLook _defaultSubItemLook;
		/// <summary>
		/// The default look to use for sub-items.
		/// </summary>
    /// <seealso cref="Look" />
    [Description("The default look to use for sub-items.")]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public ItemLook DefaultSubItemLook
		{
			get
			{
        if(_defaultSubItemLook != null)
        {
          return _defaultSubItemLook;
        }
        else
        {
          ItemLook lookTranslator = GetTranslator();
          lookTranslator.ForDefaultSubItem = true;
          lookTranslator.LookType = ItemLookType.Normal;
          return lookTranslator;
        }
			}
			set
			{
				if(value != null)
				{
					ItemLook lookTranslator = GetTranslator();
					lookTranslator.ForDefaultSubItem = true;
					lookTranslator.LookType = ItemLookType.Normal;
					value.CopyTo(lookTranslator, !m_bLooksApplied);
				}
			}
		}

		/// <summary>
		/// The ID of the pre-defined default look to use for sub-items.
		/// </summary>
		[Category("ItemLook")]
		[DefaultValue(null)]
		[Description("The ID of the pre-defined default look to use for sub-items.")]
    public string DefaultSubItemLookId
    {
      get 
      {
        return Properties[GetAttributeVarName("DefaultSubItemLookId")]; 
      }
      set 
      {
        Properties[GetAttributeVarName("DefaultSubItemLookId")] = value;
      }
    }

    private ItemLook _defaultSubItemSelectedLook;
    /// <summary>
    /// The default look to use for sub-items when they are selected.
    /// </summary>
    /// <seealso cref="Look" />
    [Description("The default look to use for sub-items when they are selected.")]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public ItemLook DefaultSubItemSelectedLook
    {
      get
      {
        if(_defaultSubItemSelectedLook != null)
        {
          return _defaultSubItemSelectedLook;
        }
        else
        {
          ItemLook lookTranslator = GetTranslator();
          lookTranslator.ForDefaultSubItem = true;
          lookTranslator.LookType = ItemLookType.Selected;
          return lookTranslator;
        }
      }
      set
      {
        if(value != null)
        {
          ItemLook lookTranslator = GetTranslator();
          lookTranslator.ForDefaultSubItem = true;
          lookTranslator.LookType = ItemLookType.Selected;
          value.CopyTo(lookTranslator, !m_bLooksApplied);
        }
      }
    }

    /// <summary>
    /// The ID of the default look to use for sub-items when they are selected.
    /// </summary>
		[Category("ItemLook")]
		[DefaultValue(null)]
		[Description("The ID of the default look to use for sub-items when they are selected.")]
    public string DefaultSubItemSelectedLookId
    {
      get 
      {
        return Properties[GetAttributeVarName("DefaultSubItemSelectedLookId")]; 
      }
      set 
      {
        Properties[GetAttributeVarName("DefaultSubItemSelectedLookId")] = value;
      }
    }

    #endregion

    /// <summary>
    /// The default text alignment to apply to labels of sub-items.
    /// </summary>
    [Category("Appearance")]
    [DefaultValue(TextAlign.Left)]
    [Description("The default text alignment to apply to labels of sub-items.")]
    public TextAlign DefaultSubItemTextAlign
    {
      get
      {
        string o = this.Properties[GetAttributeVarName("DefaultSubItemTextAlign")];
        return (o != null) ? Utils.ParseTextAlign(o) :
          (this.ParentItem != null) ? this.ParentItem.DefaultSubItemTextAlign :
          (this.ParentBaseMenu != null) ? this.ParentBaseMenu.DefaultItemTextAlign :
          TextAlign.Left;
      }
      set
      {
        Properties[GetAttributeVarName("DefaultSubItemTextAlign")] = value.ToString();
      }
    }

    /// <summary>
    /// Whether to wrap text in sub-item labels by default.
    /// </summary>
    [Category("Layout")]
    [DefaultValue(false)]
    [Description("Whether to wrap text in sub-item labels by default.")]
    public bool DefaultSubItemTextWrap
    {
      get
      {
        string o = this.Properties[GetAttributeVarName("DefaultSubItemTextWrap")];
        return (o != null) ? Utils.ParseBool(o, false) :
          (this.ParentItem != null) ? this.ParentItem.DefaultSubItemTextWrap :
          (this.ParentBaseMenu != null) ? this.ParentBaseMenu.DefaultItemTextWrap : false;
      }
      set
      {
        Properties[GetAttributeVarName("DefaultSubItemTextWrap")] = value.ToString();
      }
    }

    /// <summary>
    /// The look to use for this item when it is disabled.
    /// </summary>
    /// <seealso cref="Look" />
    [Description("The look to use for this item when it is disabled.")]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public ItemLook DisabledLook
    {
      get
      {
        ItemLook lookTranslator = GetTranslator();
        lookTranslator.ForDefaultSubItem = false;
        lookTranslator.LookType = ItemLookType.Disabled;
        return lookTranslator;
      }
      set
      {
        if(value != null)
        {
          ItemLook lookTranslator = GetTranslator();
          lookTranslator.ForDefaultSubItem = false;
          lookTranslator.LookType = ItemLookType.Disabled;
          value.CopyTo(lookTranslator, !m_bLooksApplied);
        }
      }
    }

    /// <summary>
    /// The ID of the pre-defined look to use for this item when it is disabled.
    /// </summary>
		[Category("ItemLook")]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -