예제 #1
0
        public override void MergeWith(Style s)
        {
            if ((s == null) || (s.IsEmpty))
            {
                return;
            }

            base.MergeWith(s);
            MenuItemStyle with = s as MenuItemStyle;

            if (with == null)
            {
                return;
            }

            if (!CheckBit((int)MenuItemStyles.HorizontalPadding) && with.CheckBit((int)MenuItemStyles.HorizontalPadding))
            {
                HorizontalPadding = with.HorizontalPadding;
            }

            if (!CheckBit((int)MenuItemStyles.ItemSpacing) && with.CheckBit((int)MenuItemStyles.ItemSpacing))
            {
                ItemSpacing = with.ItemSpacing;
            }

            if (!CheckBit((int)MenuItemStyles.VerticalPadding) && with.CheckBit((int)MenuItemStyles.VerticalPadding))
            {
                VerticalPadding = with.VerticalPadding;
            }
        }
 public override void MergeWith(Style s)
 {
     if (s != null)
     {
         if (this.IsEmpty)
         {
             this.CopyFrom(s);
         }
         else
         {
             base.MergeWith(s);
             MenuItemStyle style = s as MenuItemStyle;
             if ((style != null) && !style.IsEmpty)
             {
                 if (s.RegisteredCssClass.Length == 0)
                 {
                     if (style.IsSet(0x10000) && !base.IsSet(0x10000))
                     {
                         this.VerticalPadding = style.VerticalPadding;
                     }
                     if (style.IsSet(0x20000) && !base.IsSet(0x20000))
                     {
                         this.HorizontalPadding = style.HorizontalPadding;
                     }
                 }
                 if (style.IsSet(0x40000) && !base.IsSet(0x40000))
                 {
                     this.ItemSpacing = style.ItemSpacing;
                 }
             }
         }
     }
 }
예제 #3
0
        public override void CopyFrom(Style s)
        {
            if (s == null || s.IsEmpty)
            {
                return;
            }

            base.CopyFrom(s);
            MenuItemStyle from = s as MenuItemStyle;

            if (from == null)
            {
                return;
            }

            if (from.CheckBit((int)MenuItemStyles.HorizontalPadding))
            {
                HorizontalPadding = from.HorizontalPadding;
            }

            if (from.CheckBit((int)MenuItemStyles.ItemSpacing))
            {
                ItemSpacing = from.ItemSpacing;
            }

            if (from.CheckBit((int)MenuItemStyles.VerticalPadding))
            {
                VerticalPadding = from.VerticalPadding;
            }
        }
예제 #4
0
        protected override void OnInsert(int index, object value)
        {
            base.OnInsert(index, value);
            if (!(value is MenuItemStyle))
            {
                throw new ArgumentException(System.Web.SR.GetString("MenuItemStyleCollection_InvalidArgument"), "value");
            }
            MenuItemStyle style = (MenuItemStyle)value;

            style.Font.Underline = style.Font.Underline;
        }
예제 #5
0
        /// <devdoc>
        ///    Copies non-blank elements from the specified style, overwriting existing
        ///    style elements if necessary.
        /// </devdoc>
        public override void CopyFrom(Style s)
        {
            if (s != null)
            {
                base.CopyFrom(s);

                MenuItemStyle mis = s as MenuItemStyle;
                if (mis != null && !mis.IsEmpty)
                {
                    // Only copy the Css attributes if they aren't included in the source Style's registered CSS class
                    if (s.RegisteredCssClass.Length != 0)
                    {
                        if (mis.IsSet(PROP_VPADDING))
                        {
                            ViewState.Remove("VerticalPadding");
                            ClearBit(PROP_VPADDING);
                        }

                        if (mis.IsSet(PROP_HPADDING))
                        {
                            ViewState.Remove("HorizontalPadding");
                            ClearBit(PROP_HPADDING);
                        }
                    }
                    else
                    {
                        if (mis.IsSet(PROP_VPADDING))
                        {
                            this.VerticalPadding = mis.VerticalPadding;
                        }

                        if (mis.IsSet(PROP_HPADDING))
                        {
                            this.HorizontalPadding = mis.HorizontalPadding;
                        }
                    }

                    // Item spacing is not rendered in the registered css, so we always copy it
                    if (mis.IsSet(PROP_ITEMSPACING))
                    {
                        this.ItemSpacing = mis.ItemSpacing;
                    }
                }
            }
        }
예제 #6
0
        public override void MergeWith(Style s)
        {
            if (s != null)
            {
                if (IsEmpty)
                {
                    // Merging with an empty style is equivalent to copying,
                    // which is more efficient.
                    CopyFrom(s);
                    return;
                }

                base.MergeWith(s);

                MenuItemStyle mis = s as MenuItemStyle;
                if (mis != null && !mis.IsEmpty)
                {
                    // Since we're already copying the registered CSS class in base.MergeWith, we don't
                    // need to any attributes that would be included in that class.
                    if (s.RegisteredCssClass.Length == 0)
                    {
                        if (mis.IsSet(PROP_VPADDING) && !this.IsSet(PROP_VPADDING))
                        {
                            this.VerticalPadding = mis.VerticalPadding;
                        }

                        if (mis.IsSet(PROP_HPADDING) && !this.IsSet(PROP_HPADDING))
                        {
                            this.HorizontalPadding = mis.HorizontalPadding;
                        }
                    }

                    if (mis.IsSet(PROP_ITEMSPACING) && !this.IsSet(PROP_ITEMSPACING))
                    {
                        this.ItemSpacing = mis.ItemSpacing;
                    }
                }
            }
        }
 public override void CopyFrom(Style s)
 {
     if (s != null)
     {
         base.CopyFrom(s);
         MenuItemStyle style = s as MenuItemStyle;
         if ((style != null) && !style.IsEmpty)
         {
             if (s.RegisteredCssClass.Length != 0)
             {
                 if (style.IsSet(0x10000))
                 {
                     base.ViewState.Remove("VerticalPadding");
                     base.ClearBit(0x10000);
                 }
                 if (style.IsSet(0x20000))
                 {
                     base.ViewState.Remove("HorizontalPadding");
                     base.ClearBit(0x20000);
                 }
             }
             else
             {
                 if (style.IsSet(0x10000))
                 {
                     this.VerticalPadding = style.VerticalPadding;
                 }
                 if (style.IsSet(0x20000))
                 {
                     this.HorizontalPadding = style.HorizontalPadding;
                 }
             }
             if (style.IsSet(0x40000))
             {
                 this.ItemSpacing = style.ItemSpacing;
             }
         }
     }
 }
예제 #8
0
            public OwnerContext(BaseMenuRenderer container)
            {
                if (container == null)
                {
                    throw new ArgumentNullException("container");
                }

                this.container = container;
                Menu owner = container.Owner;
                Page page  = owner.Page;

                Header               = page != null ? page.Header : null;
                ClientID             = owner.ClientID;
                IsVertical           = owner.Orientation == Orientation.Vertical;
                StaticSubMenuIndent  = owner.StaticSubMenuIndent;
                SelectedItem         = owner.SelectedItem;
                ControlLinkStyle     = owner.ControlLinkStyle;
                StaticDisplayLevels  = owner.StaticDisplayLevels;
                StaticMenuItemStyle  = owner.StaticMenuItemStyleInternal;
                DynamicMenuItemStyle = owner.DynamicMenuItemStyleInternal;
                LevelMenuItemStyles  = owner.LevelMenuItemStyles;
            }
예제 #9
0
 public int Add(MenuItemStyle style)
 {
     return(default(int));
 }
예제 #10
0
 public bool Contains(MenuItemStyle style)
 {
     return(((IList)this).Contains(style));
 }
        public int IndexOf(MenuItemStyle style)
        {
            Contract.Ensures(Contract.Result <int>() >= -1);

            return(default(int));
        }
예제 #12
0
        protected override void RenderMenuItem(HtmlTextWriter writer, MenuItem item, bool vertical, bool notLast, bool isFirst, OwnerContext oc)
        {
            Menu   owner           = Owner;
            string clientID        = oc.ClientID;
            bool   displayChildren = owner.DisplayChildren(item);
            bool   dynamicChildren = displayChildren && (item.Depth + 1 >= oc.StaticDisplayLevels);
            bool   isDynamicItem   = IsDynamicItem(owner, item);
            bool   isVertical      = oc.IsVertical || isDynamicItem;
            Unit   itemSpacing     = owner.GetItemSpacing(item, isDynamicItem);

            if (itemSpacing != Unit.Empty && (item.Depth > 0 || !isFirst))
            {
                RenderMenuItemSpacing(writer, itemSpacing, isVertical);
            }

            if (!String.IsNullOrEmpty(item.ToolTip))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, item.ToolTip);
            }
            if (isVertical)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            }

            string parentId = isDynamicItem ? "'" + item.Parent.Path + "'" : "null";

            if (dynamicChildren)
            {
                writer.AddAttribute("onmouseover",
                                    "javascript:Menu_OverItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
                writer.AddAttribute("onmouseout",
                                    "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "')");
            }
            else if (isDynamicItem)
            {
                writer.AddAttribute("onmouseover",
                                    "javascript:Menu_OverDynamicLeafItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
                writer.AddAttribute("onmouseout",
                                    "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
            }
            else
            {
                writer.AddAttribute("onmouseover",
                                    "javascript:Menu_OverStaticLeafItem ('" + clientID + "','" + item.Path + "')");
                writer.AddAttribute("onmouseout",
                                    "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "')");
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Top separator image

            if (isDynamicItem)
            {
                RenderSeparatorImage(owner, writer, oc.DynamicTopSeparatorImageUrl, false);
            }
            else
            {
                RenderSeparatorImage(owner, writer, oc.StaticTopSeparatorImageUrl, false);
            }

            // Menu item box

            MenuItemStyle style = new MenuItemStyle();

            if (oc.Header != null)
            {
                // styles are registered
                if (!isDynamicItem && oc.StaticMenuItemStyle != null)
                {
                    AddCssClass(style, oc.StaticMenuItemStyle.CssClass);
                    AddCssClass(style, oc.StaticMenuItemStyle.RegisteredCssClass);
                }
                if (isDynamicItem && oc.DynamicMenuItemStyle != null)
                {
                    AddCssClass(style, oc.DynamicMenuItemStyle.CssClass);
                    AddCssClass(style, oc.DynamicMenuItemStyle.RegisteredCssClass);
                }
                if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth)
                {
                    AddCssClass(style, oc.LevelMenuItemStyles [item.Depth].CssClass);
                    AddCssClass(style, oc.LevelMenuItemStyles [item.Depth].RegisteredCssClass);
                }
                if (item == oc.SelectedItem)
                {
                    if (!isDynamicItem && oc.StaticSelectedStyle != null)
                    {
                        AddCssClass(style, oc.StaticSelectedStyle.CssClass);
                        AddCssClass(style, oc.StaticSelectedStyle.RegisteredCssClass);
                    }
                    if (isDynamicItem && oc.DynamicSelectedStyle != null)
                    {
                        AddCssClass(style, oc.DynamicSelectedStyle.CssClass);
                        AddCssClass(style, oc.DynamicSelectedStyle.RegisteredCssClass);
                    }
                    if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth)
                    {
                        AddCssClass(style, oc.LevelSelectedStyles [item.Depth].CssClass);
                        AddCssClass(style, oc.LevelSelectedStyles [item.Depth].RegisteredCssClass);
                    }
                }
            }
            else
            {
                // styles are not registered
                if (!isDynamicItem && oc.StaticMenuItemStyle != null)
                {
                    style.CopyFrom(oc.StaticMenuItemStyle);
                }
                if (isDynamicItem && oc.DynamicMenuItemStyle != null)
                {
                    style.CopyFrom(oc.DynamicMenuItemStyle);
                }
                if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth)
                {
                    style.CopyFrom(oc.LevelMenuItemStyles [item.Depth]);
                }
                if (item == oc.SelectedItem)
                {
                    if (!isDynamicItem && oc.StaticSelectedStyle != null)
                    {
                        style.CopyFrom(oc.StaticSelectedStyle);
                    }
                    if (isDynamicItem && oc.DynamicSelectedStyle != null)
                    {
                        style.CopyFrom(oc.DynamicSelectedStyle);
                    }
                    if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth)
                    {
                        style.CopyFrom(oc.LevelSelectedStyles [item.Depth]);
                    }
                }
            }
            style.AddAttributesToRender(writer);

            writer.AddAttribute("id", GetItemClientId(clientID, item, "i"));
            writer.AddAttribute("cellpadding", "0", false);
            writer.AddAttribute("cellspacing", "0", false);
            writer.AddAttribute("border", "0", false);
            writer.AddAttribute("width", "100%", false);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Menu item text

            if (isVertical)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            }
            if (!owner.ItemWrap)
            {
                writer.AddStyleAttribute("white-space", "nowrap");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            RenderItemHref(owner, writer, item);

            Style linkStyle = new Style();

            if (oc.Header != null)
            {
                // styles are registered
                AddCssClass(linkStyle, oc.ControlLinkStyle.RegisteredCssClass);

                if (!isDynamicItem && oc.StaticMenuItemStyle != null)
                {
                    AddCssClass(linkStyle, oc.StaticMenuItemStyle.CssClass);
                    AddCssClass(linkStyle, oc.StaticMenuItemLinkStyle.RegisteredCssClass);
                }
                if (isDynamicItem && oc.DynamicMenuItemStyle != null)
                {
                    AddCssClass(linkStyle, oc.DynamicMenuItemStyle.CssClass);
                    AddCssClass(linkStyle, oc.DynamicMenuItemLinkStyle.RegisteredCssClass);
                }
                if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth)
                {
                    AddCssClass(linkStyle, oc.LevelMenuItemStyles [item.Depth].CssClass);
                    AddCssClass(linkStyle, oc.LevelMenuItemLinkStyles [item.Depth].RegisteredCssClass);
                }
                if (item == oc.SelectedItem)
                {
                    if (!isDynamicItem && oc.StaticSelectedStyle != null)
                    {
                        AddCssClass(linkStyle, oc.StaticSelectedStyle.CssClass);
                        AddCssClass(linkStyle, oc.StaticSelectedLinkStyle.RegisteredCssClass);
                    }
                    if (isDynamicItem && oc.DynamicSelectedStyle != null)
                    {
                        AddCssClass(linkStyle, oc.DynamicSelectedStyle.CssClass);
                        AddCssClass(linkStyle, oc.DynamicSelectedLinkStyle.RegisteredCssClass);
                    }
                    if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth)
                    {
                        AddCssClass(linkStyle, oc.LevelSelectedStyles [item.Depth].CssClass);
                        AddCssClass(linkStyle, oc.LevelSelectedLinkStyles [item.Depth].RegisteredCssClass);
                    }
                }
            }
            else
            {
                // styles are not registered
                linkStyle.CopyFrom(oc.ControlLinkStyle);

                if (!isDynamicItem && oc.StaticMenuItemStyle != null)
                {
                    linkStyle.CopyFrom(oc.StaticMenuItemLinkStyle);
                }
                if (isDynamicItem && oc.DynamicMenuItemStyle != null)
                {
                    linkStyle.CopyFrom(oc.DynamicMenuItemLinkStyle);
                }
                if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth)
                {
                    linkStyle.CopyFrom(oc.LevelMenuItemLinkStyles [item.Depth]);
                }
                if (item == oc.SelectedItem)
                {
                    if (!isDynamicItem && oc.StaticSelectedStyle != null)
                    {
                        linkStyle.CopyFrom(oc.StaticSelectedLinkStyle);
                    }
                    if (isDynamicItem && oc.DynamicSelectedStyle != null)
                    {
                        linkStyle.CopyFrom(oc.DynamicSelectedLinkStyle);
                    }
                    if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth)
                    {
                        linkStyle.CopyFrom(oc.LevelSelectedLinkStyles [item.Depth]);
                    }
                }

                linkStyle.AlwaysRenderTextDecoration = true;
            }
            linkStyle.AddAttributesToRender(writer);

            writer.AddAttribute("id", GetItemClientId(clientID, item, "l"));

            if (item.Depth > 0 && !isDynamicItem)
            {
                double value;
#if NET_4_0
                Unit unit = oc.StaticSubMenuIndent;
                if (unit == Unit.Empty)
                {
                    value = 16;
                }
                else
                {
                    value = unit.Value;
                }
#else
                value = oc.StaticSubMenuIndent.Value;
#endif
                Unit indent = new Unit(value * item.Depth, oc.StaticSubMenuIndent.Type);
                writer.AddStyleAttribute(HtmlTextWriterStyle.MarginLeft, indent.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            owner.RenderItemContent(writer, item, isDynamicItem);
            writer.RenderEndTag();              // A

            writer.RenderEndTag();              // TD

            // Popup image

            if (dynamicChildren)
            {
                string popOutImage = GetPopOutImage(owner, item, isDynamicItem);
                if (popOutImage != null)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.AddAttribute("src", owner.ResolveClientUrl(popOutImage));
                    writer.AddAttribute("border", "0");
                    string toolTip = String.Format(isDynamicItem ? oc.DynamicPopOutImageTextFormatString : oc.StaticPopOutImageTextFormatString, item.Text);
                    writer.AddAttribute(HtmlTextWriterAttribute.Alt, toolTip);
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag();                      // IMG
                    writer.RenderEndTag();                      // TD
                }
            }

            writer.RenderEndTag();              // TR
            writer.RenderEndTag();              // TABLE

            writer.RenderEndTag();              // TD

            if (!isVertical && itemSpacing == Unit.Empty && (notLast || (displayChildren && !dynamicChildren)))
            {
                writer.AddStyleAttribute("width", "3px");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderEndTag();
            }

            // Bottom separator image
            string separatorImg = item.SeparatorImageUrl;
            if (separatorImg.Length == 0)
            {
                if (isDynamicItem)
                {
                    separatorImg = oc.DynamicBottomSeparatorImageUrl;
                }
                else
                {
                    separatorImg = oc.StaticBottomSeparatorImageUrl;
                }
            }

            if (separatorImg.Length > 0)
            {
                if (!isVertical)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                }
                RenderSeparatorImage(owner, writer, separatorImg, false);
                if (!isVertical)
                {
                    writer.RenderEndTag();                      // TD
                }
            }

            if (isVertical)
            {
                writer.RenderEndTag();                  // TR
            }
            if (itemSpacing != Unit.Empty)
            {
                RenderMenuItemSpacing(writer, itemSpacing, isVertical);
            }

            // Submenu

            if (displayChildren && !dynamicChildren)
            {
                if (isVertical)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute("width", "100%");
                owner.RenderMenu(writer, item.ChildItems, vertical, false, item.Depth + 1, notLast);
                if (item.Depth + 2 == oc.StaticDisplayLevels)
                {
                    owner.RenderDynamicMenu(writer, item.ChildItems);
                }
                writer.RenderEndTag();                  // TD
                if (isVertical)
                {
                    writer.RenderEndTag();                      // TR
                }
            }
        }
예제 #13
0
		void RenderMenuItem (HtmlTextWriter writer, MenuItem item, bool notLast, bool isFirst) {
			bool displayChildren = DisplayChildren (item);
			bool dynamicChildren = displayChildren && (item.Depth + 1 >= StaticDisplayLevels);
			bool isDynamicItem = IsDynamicItem (item);
			bool vertical = (Orientation == Orientation.Vertical) || isDynamicItem;
			
			Unit itemSpacing = GetItemSpacing (item, isDynamicItem);

			if (itemSpacing != Unit.Empty && (item.Depth > 0 || !isFirst))
				RenderMenuItemSpacing (writer, itemSpacing, vertical);

			if(!String.IsNullOrEmpty(item.ToolTip))
				writer.AddAttribute (HtmlTextWriterAttribute.Title, item.ToolTip);
			if (vertical)
				writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			string parentId = isDynamicItem ? "'" + item.Parent.Path + "'" : "null";
			if (dynamicChildren) {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "')");
			} else if (isDynamicItem) {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverDynamicLeafItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
			} else {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverStaticLeafItem ('" + ClientID + "','" + item.Path + "')");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "')");
			}

			writer.RenderBeginTag (HtmlTextWriterTag.Td);

			// Top separator image

			if (isDynamicItem && DynamicTopSeparatorImageUrl != "") {
				writer.AddAttribute ("src", ResolveClientUrl (DynamicTopSeparatorImageUrl));
				writer.RenderBeginTag (HtmlTextWriterTag.Img);
				writer.RenderEndTag ();	// IMG
			}
			else if (!isDynamicItem && StaticTopSeparatorImageUrl != "") {
				writer.AddAttribute ("src", ResolveClientUrl (StaticTopSeparatorImageUrl));
				writer.RenderBeginTag (HtmlTextWriterTag.Img);
				writer.RenderEndTag ();	// IMG
			}

			// Menu item box
			
			MenuItemStyle style = new MenuItemStyle ();
			if (Page.Header != null) {
				// styles are registered
				if (!isDynamicItem && staticMenuItemStyle != null) {
					AddCssClass (style, staticMenuItemStyle.CssClass);
					AddCssClass (style, staticMenuItemStyle.RegisteredCssClass);
				}
				if (isDynamicItem && dynamicMenuItemStyle != null) {
					AddCssClass (style, dynamicMenuItemStyle.CssClass);
					AddCssClass (style, dynamicMenuItemStyle.RegisteredCssClass);
				}
				if (levelMenuItemStyles != null && levelMenuItemStyles.Count > item.Depth) {
					AddCssClass (style, levelMenuItemStyles [item.Depth].CssClass);
					AddCssClass (style, levelMenuItemStyles [item.Depth].RegisteredCssClass);
				}
				if (item == SelectedItem) {
					if (!isDynamicItem && staticSelectedStyle != null) {
						AddCssClass (style, staticSelectedStyle.CssClass);
						AddCssClass (style, staticSelectedStyle.RegisteredCssClass);
					}
					if (isDynamicItem && dynamicSelectedStyle != null) {
						AddCssClass (style, dynamicSelectedStyle.CssClass);
						AddCssClass (style, dynamicSelectedStyle.RegisteredCssClass);
					}
					if (levelSelectedStyles != null && levelSelectedStyles.Count > item.Depth) {
						AddCssClass (style, levelSelectedStyles [item.Depth].CssClass);
						AddCssClass (style, levelSelectedStyles [item.Depth].RegisteredCssClass);
					}
				}
			}
			else {
				// styles are not registered
				if (!isDynamicItem && staticMenuItemStyle != null) {
					style.CopyFrom (staticMenuItemStyle);
				}
				if (isDynamicItem && dynamicMenuItemStyle != null) {
					style.CopyFrom (dynamicMenuItemStyle);
				}
				if (levelMenuItemStyles != null && levelMenuItemStyles.Count > item.Depth) {
					style.CopyFrom (levelMenuItemStyles [item.Depth]);
				}
				if (item == SelectedItem) {
					if (!isDynamicItem && staticSelectedStyle != null) {
						style.CopyFrom (staticSelectedStyle);
					}
					if (isDynamicItem && dynamicSelectedStyle != null) {
						style.CopyFrom (dynamicSelectedStyle);
					}
					if (levelSelectedStyles != null && levelSelectedStyles.Count > item.Depth) {
						style.CopyFrom (levelSelectedStyles [item.Depth]);
					}
				}
			}
			style.AddAttributesToRender (writer);

			writer.AddAttribute ("id", GetItemClientId (item, "i"));

			writer.AddAttribute ("cellpadding", "0", false);
			writer.AddAttribute ("cellspacing", "0", false);
			writer.AddAttribute ("border", "0", false);
			writer.AddAttribute ("width", "100%", false);
			writer.RenderBeginTag (HtmlTextWriterTag.Table);
			writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			// Menu item text

			if (vertical)
				writer.AddStyleAttribute (HtmlTextWriterStyle.Width, "100%");
			if (!ItemWrap)
				writer.AddStyleAttribute ("white-space", "nowrap");
			writer.RenderBeginTag (HtmlTextWriterTag.Td);

			RenderItemHref (writer, item);
			
			Style linkStyle = new Style ();
			if (Page.Header != null) {
				// styles are registered
				AddCssClass (linkStyle, ControlLinkStyle.RegisteredCssClass);

				if (!isDynamicItem && staticMenuItemStyle != null) {
					AddCssClass (linkStyle, staticMenuItemStyle.CssClass);
					AddCssClass (linkStyle, staticMenuItemLinkStyle.RegisteredCssClass);
				}
				if (isDynamicItem && dynamicMenuItemStyle != null) {
					AddCssClass (linkStyle, dynamicMenuItemStyle.CssClass);
					AddCssClass (linkStyle, dynamicMenuItemLinkStyle.RegisteredCssClass);
				}
				if (levelMenuItemStyles != null && levelMenuItemStyles.Count > item.Depth) {
					AddCssClass (linkStyle, levelMenuItemStyles [item.Depth].CssClass);
					AddCssClass (linkStyle, levelMenuItemLinkStyles [item.Depth].RegisteredCssClass);
				}
				if (item == SelectedItem) {
					if (!isDynamicItem && staticSelectedStyle != null) {
						AddCssClass (linkStyle, staticSelectedStyle.CssClass);
						AddCssClass (linkStyle, staticSelectedLinkStyle.RegisteredCssClass);
					}
					if (isDynamicItem && dynamicSelectedStyle != null) {
						AddCssClass (linkStyle, dynamicSelectedStyle.CssClass);
						AddCssClass (linkStyle, dynamicSelectedLinkStyle.RegisteredCssClass);
					}
					if (levelSelectedStyles != null && levelSelectedStyles.Count > item.Depth) {
						AddCssClass (linkStyle, levelSelectedStyles [item.Depth].CssClass);
						AddCssClass (linkStyle, levelSelectedLinkStyles [item.Depth].RegisteredCssClass);
					}
				}
			}
			else {
				// styles are not registered
				linkStyle.CopyFrom (ControlLinkStyle);

				if (!isDynamicItem && staticMenuItemStyle != null) {
					linkStyle.CopyFrom (staticMenuItemLinkStyle);
				}
				if (isDynamicItem && dynamicMenuItemStyle != null) {
					linkStyle.CopyFrom (dynamicMenuItemLinkStyle);
				}
				if (levelMenuItemStyles != null && levelMenuItemStyles.Count > item.Depth) {
					linkStyle.CopyFrom (levelMenuItemLinkStyles [item.Depth]);
				}
				if (item == SelectedItem) {
					if (!isDynamicItem && staticSelectedStyle != null) {
						linkStyle.CopyFrom (staticSelectedLinkStyle);
					}
					if (isDynamicItem && dynamicSelectedStyle != null) {
						linkStyle.CopyFrom (dynamicSelectedLinkStyle);
					}
					if (levelSelectedStyles != null && levelSelectedStyles.Count > item.Depth) {
						linkStyle.CopyFrom (levelSelectedLinkStyles [item.Depth]);
					}
				}

				linkStyle.AlwaysRenderTextDecoration = true;
			}
			linkStyle.AddAttributesToRender (writer);

			writer.AddAttribute ("id", GetItemClientId (item, "l"));
			
			if (item.Depth > 0 && !isDynamicItem) {
				Unit indent = new Unit (StaticSubMenuIndent.Value * item.Depth, StaticSubMenuIndent.Type);
				writer.AddStyleAttribute ("margin-left", indent.ToString ());
			}
			writer.RenderBeginTag (HtmlTextWriterTag.A);
			RenderItemContent (writer, item, isDynamicItem);
			writer.RenderEndTag ();	// A

			writer.RenderEndTag ();	// TD

			// Popup image

			if (dynamicChildren) {
				string popOutImage = GetPopOutImage (item, isDynamicItem);
				if (popOutImage != null) {
					writer.RenderBeginTag (HtmlTextWriterTag.Td);
					writer.AddAttribute ("src", ResolveClientUrl (popOutImage));
					writer.AddAttribute ("border", "0");
					string toolTip = String.Format (isDynamicItem ? DynamicPopOutImageTextFormatString : StaticPopOutImageTextFormatString, item.Text);
					writer.AddAttribute (HtmlTextWriterAttribute.Alt, toolTip);
					writer.RenderBeginTag (HtmlTextWriterTag.Img);
					writer.RenderEndTag ();	// IMG
					writer.RenderEndTag ();	// TD
				}
			}

			writer.RenderEndTag ();	// TR
			writer.RenderEndTag ();	// TABLE
			
			writer.RenderEndTag ();	// TD

			if (!vertical && itemSpacing == Unit.Empty && (notLast || (displayChildren && !dynamicChildren))) {
				writer.AddStyleAttribute ("width", "3px");
				writer.RenderBeginTag (HtmlTextWriterTag.Td);
				writer.RenderEndTag ();
			}
			
			// Bottom separator image
			string separatorImg = item.SeparatorImageUrl;
			if (separatorImg.Length == 0) {
				if (isDynamicItem)
					separatorImg = DynamicBottomSeparatorImageUrl;
				else
					separatorImg = StaticBottomSeparatorImageUrl;
			}
			if (separatorImg.Length > 0) {
				if (!vertical)
					writer.RenderBeginTag (HtmlTextWriterTag.Td);
				writer.AddAttribute ("src", ResolveClientUrl (separatorImg));
				writer.RenderBeginTag (HtmlTextWriterTag.Img);
				writer.RenderEndTag ();	// IMG
				if (!vertical)
					writer.RenderEndTag (); // TD
			}

			if (vertical)
				writer.RenderEndTag ();	// TR

			if (itemSpacing != Unit.Empty)
				RenderMenuItemSpacing (writer, itemSpacing, vertical);

			// Submenu

			if (displayChildren && !dynamicChildren) {
				if (vertical)
					writer.RenderBeginTag (HtmlTextWriterTag.Tr);
				writer.RenderBeginTag (HtmlTextWriterTag.Td);
				writer.AddAttribute ("width", "100%");
				RenderMenu (writer, item.ChildItems, Orientation == Orientation.Vertical, false, item.Depth + 1, notLast);
				if (item.Depth + 2 == StaticDisplayLevels)
					RenderDynamicMenu (writer, item.ChildItems);
				writer.RenderEndTag ();	// TD
				if (vertical)
					writer.RenderEndTag ();	// TR
			}

		}
예제 #14
0
 public void Insert(int index, MenuItemStyle style)
 {
 }
예제 #15
0
 private void RenderStyle(HtmlTextWriter writer, WebControl control, string className, MenuItemStyle style, bool applyInlineBorder) {
     if (!String.IsNullOrEmpty(className)) {
         control.CssClass = className;
         if (applyInlineBorder) {
             // Add inline style to force the border to none to override any CssClass (VSWhidbey 336610)
             writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "none");
             // And an inline font-size of 1em to avoid squaring relative font sizes by applying them twice
             writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "1em");
         }
     }
     else if (style != null) {
         control.ApplyStyle(style);
     }
 }
예제 #16
0
		public int Add (MenuItemStyle style)
		{
			return ((IList)this).Add (style);
		}
예제 #17
0
        internal void RenderItem(HtmlTextWriter writer, int position, bool enabled, Orientation orientation, bool staticOnly)
        {
            enabled = enabled && this.Enabled;
            int           depth         = this.Depth;
            MenuItemStyle menuItemStyle = this._owner.GetMenuItemStyle(this);
            int           num2          = this.Depth + 1;
            bool          flag          = (depth < this._owner.StaticDisplayLevels) && (this._owner.StaticTopSeparatorImageUrl.Length != 0);
            bool          flag2         = (depth >= this._owner.StaticDisplayLevels) && (this._owner.DynamicTopSeparatorImageUrl.Length != 0);

            if (flag || flag2)
            {
                if (orientation == Orientation.Vertical)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if (flag)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, this._owner.ResolveClientUrl(this._owner.StaticTopSeparatorImageUrl));
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, this._owner.ResolveClientUrl(this._owner.DynamicTopSeparatorImageUrl));
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Alt, string.Empty);
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
                writer.RenderEndTag();
                if (orientation == Orientation.Vertical)
                {
                    writer.RenderEndTag();
                }
            }
            if (((menuItemStyle != null) && !menuItemStyle.ItemSpacing.IsEmpty) && ((depth != 0) || (position != 0)))
            {
                this.RenderItemSpacing(writer, menuItemStyle.ItemSpacing, orientation);
            }
            if (!staticOnly && this._owner.Enabled)
            {
                if (num2 > this._owner.StaticDisplayLevels)
                {
                    if ((this.Selectable && this.Enabled) || (this.ChildItems.Count != 0))
                    {
                        writer.AddAttribute("onmouseover", "Menu_HoverDynamic(this)");
                        this.RenderItemEvents(writer);
                    }
                    else
                    {
                        writer.AddAttribute("onmouseover", "Menu_HoverDisabled(this)");
                        writer.AddAttribute("onmouseout", "Menu_Unhover(this)");
                    }
                }
                else if (num2 == this._owner.StaticDisplayLevels)
                {
                    if ((this.Selectable && this.Enabled) || (this.ChildItems.Count != 0))
                    {
                        writer.AddAttribute("onmouseover", "Menu_HoverStatic(this)");
                        this.RenderItemEvents(writer);
                    }
                }
                else if (this.Selectable && this.Enabled)
                {
                    writer.AddAttribute("onmouseover", "Menu_HoverRoot(this)");
                    this.RenderItemEvents(writer);
                }
            }
            if (this.ToolTip.Length != 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, this.ToolTip);
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.Id);
            if (orientation == Orientation.Vertical)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if ((this._owner.Page != null) && this._owner.Page.SupportsStyleSheets)
            {
                string cssClassName = this._owner.GetCssClassName(this, false);
                if (cssClassName.Trim().Length > 0)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClassName);
                }
            }
            else if (menuItemStyle != null)
            {
                menuItemStyle.AddAttributesToRender(writer);
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            if (!this._owner.ItemWrap)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            }
            if (orientation == Orientation.Vertical)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if ((this._owner.Page != null) && this._owner.Page.SupportsStyleSheets)
            {
                bool   flag3;
                string str2 = this._owner.GetCssClassName(this, true, out flag3);
                if (str2.Trim().Length > 0)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, str2);
                    if (flag3)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "none");
                        writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "1em");
                    }
                }
            }
            else if (menuItemStyle != null)
            {
                menuItemStyle.HyperLinkStyle.AddAttributesToRender(writer);
            }
            string accessKey = this._owner.AccessKey;

            if (enabled && this.Selectable)
            {
                if (this.NavigateUrl.Length > 0)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, this._owner.ResolveClientUrl(this.NavigateUrl));
                    string target = this.ViewState["Target"] as string;
                    if (target == null)
                    {
                        target = this._owner.Target;
                    }
                    if (target.Length > 0)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Target, target);
                    }
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, this._owner.Page.ClientScript.GetPostBackClientHyperlink(this._owner, this.InternalValuePath, true, true));
                }
                if (!this._owner.AccessKeyRendered && (accessKey.Length != 0))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, accessKey, true);
                    this._owner.AccessKeyRendered = true;
                }
            }
            else if (!enabled)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true");
            }
            else if ((this.ChildItems.Count != 0) && (num2 >= this._owner.StaticDisplayLevels))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "text");
                if (!this._owner.AccessKeyRendered && (accessKey.Length != 0))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, accessKey, true);
                    this._owner.AccessKeyRendered = true;
                }
            }
            if ((depth != 0) && (depth < this._owner.StaticDisplayLevels))
            {
                Unit staticSubMenuIndent = this._owner.StaticSubMenuIndent;
                if (staticSubMenuIndent.IsEmpty)
                {
                    staticSubMenuIndent = Unit.Pixel(0x10);
                }
                if (staticSubMenuIndent.Value != 0.0)
                {
                    double num3 = staticSubMenuIndent.Value * depth;
                    if (num3 < 32767.0)
                    {
                        staticSubMenuIndent = new Unit(num3, staticSubMenuIndent.Type);
                    }
                    else
                    {
                        staticSubMenuIndent = new Unit(32767.0, staticSubMenuIndent.Type);
                    }
                    writer.AddStyleAttribute("margin-left", staticSubMenuIndent.ToString(CultureInfo.InvariantCulture));
                }
            }
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            if ((this.ImageUrl.Length > 0) && this.NotTemplated())
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, this._owner.ResolveClientUrl(this.ImageUrl));
                writer.AddAttribute(HtmlTextWriterAttribute.Alt, this.ToolTip);
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "none");
                writer.AddStyleAttribute("vertical-align", "middle");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            this.RenderText(writer);
            writer.RenderEndTag();
            bool   flag4 = (num2 >= this._owner.StaticDisplayLevels) && (num2 < this._owner.MaximumDepth);
            string str5  = flag4 ? this.GetExpandImageUrl() : string.Empty;
            bool   flag5 = false;

            if ((((orientation == Orientation.Horizontal) && (depth < this._owner.StaticDisplayLevels)) && (!flag4 || (str5.Length == 0))) && ((menuItemStyle == null) || menuItemStyle.ItemSpacing.IsEmpty))
            {
                if (((this.Depth + 1) < this._owner.StaticDisplayLevels) && (this.ChildItems.Count != 0))
                {
                    flag5 = true;
                }
                else
                {
                    for (MenuItem item = this; item != null; item = item.Parent)
                    {
                        if ((((item.Parent == null) && (this._owner.Items.Count != 0)) && (item != this._owner.Items[this._owner.Items.Count - 1])) || (((item.Parent != null) && (item.Parent.ChildItems.Count != 0)) && (item != item.Parent.ChildItems[item.Parent.ChildItems.Count - 1])))
                        {
                            flag5 = true;
                            break;
                        }
                    }
                }
            }
            writer.RenderEndTag();
            if (flag4 && (str5.Length > 0))
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Src, str5);
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "none");
                writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                if (depth < this._owner.StaticDisplayLevels)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Alt, string.Format(CultureInfo.CurrentCulture, this._owner.StaticPopOutImageTextFormatString, new object[] { this.Text }));
                }
                else if (depth >= this._owner.StaticDisplayLevels)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Alt, string.Format(CultureInfo.CurrentCulture, this._owner.DynamicPopOutImageTextFormatString, new object[] { this.Text }));
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
                writer.RenderEndTag();
            }
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
            if (orientation == Orientation.Vertical)
            {
                writer.RenderEndTag();
            }
            if ((menuItemStyle != null) && !menuItemStyle.ItemSpacing.IsEmpty)
            {
                this.RenderItemSpacing(writer, menuItemStyle.ItemSpacing, orientation);
            }
            else if (flag5)
            {
                this.RenderItemSpacing(writer, HorizontalDefaultSpacing, orientation);
            }
            bool flag6 = this.SeparatorImageUrl.Length != 0;
            bool flag7 = (depth < this._owner.StaticDisplayLevels) && (this._owner.StaticBottomSeparatorImageUrl.Length != 0);
            bool flag8 = (depth >= this._owner.StaticDisplayLevels) && (this._owner.DynamicBottomSeparatorImageUrl.Length != 0);

            if ((flag6 || flag7) || flag8)
            {
                if (orientation == Orientation.Vertical)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if (flag6)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, this._owner.ResolveClientUrl(this.SeparatorImageUrl));
                }
                else if (flag7)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, this._owner.ResolveClientUrl(this._owner.StaticBottomSeparatorImageUrl));
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, this._owner.ResolveClientUrl(this._owner.DynamicBottomSeparatorImageUrl));
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Alt, string.Empty);
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
                writer.RenderEndTag();
                if (orientation == Orientation.Vertical)
                {
                    writer.RenderEndTag();
                }
            }
        }
    public int IndexOf (MenuItemStyle style)
    {
      Contract.Ensures (Contract.Result<int>() >= -1);

      return default(int);
    }
예제 #19
0
 public void Remove(MenuItemStyle style)
 {
     ((IList)this).Remove(style);
 }
예제 #20
0
 public void Insert(int index, MenuItemStyle style)
 {
     ((IList)this).Insert(index, style);
 }
예제 #21
0
 public int IndexOf(MenuItemStyle style)
 {
     return(((IList)this).IndexOf(style));
 }
예제 #22
0
 public bool Contains(MenuItemStyle style)
 {
     return(default(bool));
 }
예제 #23
0
		public bool Contains (MenuItemStyle style)
		{
			return ((IList)this).Contains (style);
		}
예제 #24
0
 public int IndexOf(MenuItemStyle style)
 {
     return(default(int));
 }
예제 #25
0
			public OwnerContext (BaseMenuRenderer container)
			{
				if (container == null)
					throw new ArgumentNullException ("container");

				this.container = container;
				Menu owner = container.Owner;
				Page page = owner.Page;

				Header = page != null ? page.Header : null;
				ClientID = owner.ClientID;
				IsVertical = owner.Orientation == Orientation.Vertical;
				StaticSubMenuIndent = owner.StaticSubMenuIndent;
				SelectedItem = owner.SelectedItem;
				ControlLinkStyle = owner.ControlLinkStyle;
				StaticDisplayLevels = owner.StaticDisplayLevels;
				StaticMenuItemStyle = owner.StaticMenuItemStyleInternal;
				DynamicMenuItemStyle = owner.DynamicMenuItemStyleInternal;
				LevelMenuItemStyles = owner.LevelMenuItemStyles;
			}
예제 #26
0
 public void Remove(MenuItemStyle style)
 {
 }
 public bool Contains(MenuItemStyle style)
 {
   return default(bool);
 }
예제 #28
0
		protected override void RenderMenuItem (HtmlTextWriter writer, MenuItem item, bool vertical, bool notLast, bool isFirst, OwnerContext oc)
		{
			Menu owner = Owner;
			string clientID = oc.ClientID;
			bool displayChildren = owner.DisplayChildren (item);
			bool dynamicChildren = displayChildren && (item.Depth + 1 >= oc.StaticDisplayLevels);
			bool isDynamicItem = IsDynamicItem (owner, item);
			bool isVertical = oc.IsVertical || isDynamicItem;
			Unit itemSpacing = owner.GetItemSpacing (item, isDynamicItem);

			if (itemSpacing != Unit.Empty && (item.Depth > 0 || !isFirst))
				RenderMenuItemSpacing (writer, itemSpacing, isVertical);

			if(!String.IsNullOrEmpty(item.ToolTip))
				writer.AddAttribute (HtmlTextWriterAttribute.Title, item.ToolTip);
			if (isVertical)
				writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			string parentId = isDynamicItem ? "'" + item.Parent.Path + "'" : "null";
			if (dynamicChildren) {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "')");
			} else if (isDynamicItem) {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverDynamicLeafItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
			} else {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverStaticLeafItem ('" + clientID + "','" + item.Path + "')");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "')");
			}

			writer.RenderBeginTag (HtmlTextWriterTag.Td);

			// Top separator image

			if (isDynamicItem)
				RenderSeparatorImage (owner, writer, oc.DynamicTopSeparatorImageUrl, false);
			else
				RenderSeparatorImage (owner, writer, oc.StaticTopSeparatorImageUrl, false);

			// Menu item box
			
			MenuItemStyle style = new MenuItemStyle ();
				
			if (oc.Header != null) {
				// styles are registered
				if (!isDynamicItem && oc.StaticMenuItemStyle != null) {
					AddCssClass (style, oc.StaticMenuItemStyle.CssClass);
					AddCssClass (style, oc.StaticMenuItemStyle.RegisteredCssClass);
				}
				if (isDynamicItem && oc.DynamicMenuItemStyle != null) {
					AddCssClass (style, oc.DynamicMenuItemStyle.CssClass);
					AddCssClass (style, oc.DynamicMenuItemStyle.RegisteredCssClass);
				}
				if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth) {
					AddCssClass (style, oc.LevelMenuItemStyles [item.Depth].CssClass);
					AddCssClass (style, oc.LevelMenuItemStyles [item.Depth].RegisteredCssClass);
				}
				if (item == oc.SelectedItem) {
					if (!isDynamicItem && oc.StaticSelectedStyle != null) {
						AddCssClass (style, oc.StaticSelectedStyle.CssClass);
						AddCssClass (style, oc.StaticSelectedStyle.RegisteredCssClass);
					}
					if (isDynamicItem && oc.DynamicSelectedStyle != null) {
						AddCssClass (style, oc.DynamicSelectedStyle.CssClass);
						AddCssClass (style, oc.DynamicSelectedStyle.RegisteredCssClass);
					}
					if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth) {
						AddCssClass (style, oc.LevelSelectedStyles [item.Depth].CssClass);
						AddCssClass (style, oc.LevelSelectedStyles [item.Depth].RegisteredCssClass);
					}
				}
			} else {
				// styles are not registered
				if (!isDynamicItem && oc.StaticMenuItemStyle != null)
					style.CopyFrom (oc.StaticMenuItemStyle);
				if (isDynamicItem && oc.DynamicMenuItemStyle != null)
					style.CopyFrom (oc.DynamicMenuItemStyle);
				if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth)
					style.CopyFrom (oc.LevelMenuItemStyles [item.Depth]);
				if (item == oc.SelectedItem) {
					if (!isDynamicItem && oc.StaticSelectedStyle != null)
						style.CopyFrom (oc.StaticSelectedStyle);
					if (isDynamicItem && oc.DynamicSelectedStyle != null)
						style.CopyFrom (oc.DynamicSelectedStyle);
					if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth)
						style.CopyFrom (oc.LevelSelectedStyles [item.Depth]);
				}
			}
			style.AddAttributesToRender (writer);

			writer.AddAttribute ("id", GetItemClientId (clientID, item, "i"));
			writer.AddAttribute ("cellpadding", "0", false);
			writer.AddAttribute ("cellspacing", "0", false);
			writer.AddAttribute ("border", "0", false);
			writer.AddAttribute ("width", "100%", false);
			writer.RenderBeginTag (HtmlTextWriterTag.Table);
			writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			// Menu item text

			if (isVertical)
				writer.AddStyleAttribute (HtmlTextWriterStyle.Width, "100%");
			if (!owner.ItemWrap)
				writer.AddStyleAttribute ("white-space", "nowrap");
			writer.RenderBeginTag (HtmlTextWriterTag.Td);

			RenderItemHref (owner, writer, item);
			
			Style linkStyle = new Style ();
			if (oc.Header != null) {
				// styles are registered
				AddCssClass (linkStyle, oc.ControlLinkStyle.RegisteredCssClass);

				if (!isDynamicItem && oc.StaticMenuItemStyle != null) {
					AddCssClass (linkStyle, oc.StaticMenuItemStyle.CssClass);
					AddCssClass (linkStyle, oc.StaticMenuItemLinkStyle.RegisteredCssClass);
				}
				if (isDynamicItem && oc.DynamicMenuItemStyle != null) {
					AddCssClass (linkStyle, oc.DynamicMenuItemStyle.CssClass);
					AddCssClass (linkStyle, oc.DynamicMenuItemLinkStyle.RegisteredCssClass);
				}
				if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth) {
					AddCssClass (linkStyle, oc.LevelMenuItemStyles [item.Depth].CssClass);
					AddCssClass (linkStyle, oc.LevelMenuItemLinkStyles [item.Depth].RegisteredCssClass);
				}
				if (item == oc.SelectedItem) {
					if (!isDynamicItem && oc.StaticSelectedStyle != null) {
						AddCssClass (linkStyle, oc.StaticSelectedStyle.CssClass);
						AddCssClass (linkStyle, oc.StaticSelectedLinkStyle.RegisteredCssClass);
					}
					if (isDynamicItem && oc.DynamicSelectedStyle != null) {
						AddCssClass (linkStyle, oc.DynamicSelectedStyle.CssClass);
						AddCssClass (linkStyle, oc.DynamicSelectedLinkStyle.RegisteredCssClass);
					}
					if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth) {
						AddCssClass (linkStyle, oc.LevelSelectedStyles [item.Depth].CssClass);
						AddCssClass (linkStyle, oc.LevelSelectedLinkStyles [item.Depth].RegisteredCssClass);
					}
				}
			} else {
				// styles are not registered
				linkStyle.CopyFrom (oc.ControlLinkStyle);

				if (!isDynamicItem && oc.StaticMenuItemStyle != null)
					linkStyle.CopyFrom (oc.StaticMenuItemLinkStyle);
				if (isDynamicItem && oc.DynamicMenuItemStyle != null)
					linkStyle.CopyFrom (oc.DynamicMenuItemLinkStyle);
				if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth)
					linkStyle.CopyFrom (oc.LevelMenuItemLinkStyles [item.Depth]);
				if (item == oc.SelectedItem) {
					if (!isDynamicItem && oc.StaticSelectedStyle != null)
						linkStyle.CopyFrom (oc.StaticSelectedLinkStyle);
					if (isDynamicItem && oc.DynamicSelectedStyle != null)
						linkStyle.CopyFrom (oc.DynamicSelectedLinkStyle);
					if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth)
						linkStyle.CopyFrom (oc.LevelSelectedLinkStyles [item.Depth]);
				}

				linkStyle.AlwaysRenderTextDecoration = true;
			}
			linkStyle.AddAttributesToRender (writer);

			writer.AddAttribute ("id", GetItemClientId (clientID, item, "l"));
			
			if (item.Depth > 0 && !isDynamicItem) {
				double value;
				Unit unit = oc.StaticSubMenuIndent;
				if (unit == Unit.Empty)
					value = 16;
				else
					value = unit.Value;
				Unit indent = new Unit (value * item.Depth, oc.StaticSubMenuIndent.Type);
				writer.AddStyleAttribute (HtmlTextWriterStyle.MarginLeft, indent.ToString ());
			}
			writer.RenderBeginTag (HtmlTextWriterTag.A);
			owner.RenderItemContent (writer, item, isDynamicItem);
			writer.RenderEndTag ();	// A

			writer.RenderEndTag ();	// TD

			// Popup image

			if (dynamicChildren) {
				string popOutImage = GetPopOutImage (owner, item, isDynamicItem);
				if (popOutImage != null) {
					writer.RenderBeginTag (HtmlTextWriterTag.Td);
					writer.AddAttribute ("src", owner.ResolveClientUrl (popOutImage));
					writer.AddAttribute ("border", "0");
					string toolTip = String.Format (isDynamicItem ? oc.DynamicPopOutImageTextFormatString : oc.StaticPopOutImageTextFormatString, item.Text);
					writer.AddAttribute (HtmlTextWriterAttribute.Alt, toolTip);
					writer.RenderBeginTag (HtmlTextWriterTag.Img);
					writer.RenderEndTag ();	// IMG
					writer.RenderEndTag ();	// TD
				}
			}

			writer.RenderEndTag ();	// TR
			writer.RenderEndTag ();	// TABLE
			
			writer.RenderEndTag ();	// TD

			if (!isVertical && itemSpacing == Unit.Empty && (notLast || (displayChildren && !dynamicChildren))) {
				writer.AddStyleAttribute ("width", "3px");
				writer.RenderBeginTag (HtmlTextWriterTag.Td);
				writer.RenderEndTag ();
			}
			
			// Bottom separator image
			string separatorImg = item.SeparatorImageUrl;
			if (separatorImg.Length == 0) {
				if (isDynamicItem)
					separatorImg = oc.DynamicBottomSeparatorImageUrl;
				else
					separatorImg = oc.StaticBottomSeparatorImageUrl;
			}
			
			if (separatorImg.Length > 0) {
				if (!isVertical)
					writer.RenderBeginTag (HtmlTextWriterTag.Td);
				RenderSeparatorImage (owner, writer, separatorImg, false);
				if (!isVertical)
					writer.RenderEndTag (); // TD
			}

			if (isVertical)
				writer.RenderEndTag ();	// TR

			if (itemSpacing != Unit.Empty)
				RenderMenuItemSpacing (writer, itemSpacing, isVertical);

			// Submenu

			if (displayChildren && !dynamicChildren) {
				if (isVertical)
					writer.RenderBeginTag (HtmlTextWriterTag.Tr);
				writer.RenderBeginTag (HtmlTextWriterTag.Td);
				writer.AddAttribute ("width", "100%");
				owner.RenderMenu (writer, item.ChildItems, vertical, false, item.Depth + 1, notLast);
				if (item.Depth + 2 == oc.StaticDisplayLevels)
					owner.RenderDynamicMenu (writer, item.ChildItems);
				writer.RenderEndTag ();	// TD
				if (isVertical)
					writer.RenderEndTag ();	// TR
			}
		}
 public int IndexOf(MenuItemStyle style)
 {
   return default(int);
 }
예제 #30
0
        protected override void RenderMenuItem(HtmlTextWriter writer, MenuItem item, bool vertical, bool notLast, bool isFirst, OwnerContext oc)
        {
            Menu   owner           = Owner;
            bool   displayChildren = owner.DisplayChildren(item);
            bool   isDynamicItem   = IsDynamicItem(owner, item);
            int    itemLevel       = item.Depth + 1;
            string str;

            writer.RenderBeginTag(HtmlTextWriterTag.Li);

            if (isDynamicItem)
            {
                RenderSeparatorImage(owner, writer, oc.DynamicTopSeparatorImageUrl, true);
            }
            else
            {
                RenderSeparatorImage(owner, writer, oc.StaticTopSeparatorImageUrl, true);
            }

            var linkStyle = new Style();

            if (displayChildren && (isDynamicItem || itemLevel >= oc.StaticDisplayLevels))
            {
                AddCssClass(linkStyle, isDynamicItem && haveDynamicPopOut ? "popout-dynamic" : "popout");
            }
            AddCssClass(linkStyle, "level" + itemLevel);

            MenuItemStyleCollection levelStyles = oc.LevelMenuItemStyles;

            if (levelStyles != null && levelStyles.Count >= itemLevel)
            {
                MenuItemStyle style    = levelStyles [itemLevel - 1];
                string        cssClass = style.CssClass;
                if (!String.IsNullOrEmpty(cssClass))
                {
                    AddCssClass(linkStyle, cssClass);
                }
            }

            if (owner.SelectedItem == item)
            {
                AddCssClass(linkStyle, "selected");
            }

            str = item.ToolTip;
            if (!String.IsNullOrEmpty(str))
            {
                writer.AddAttribute("title", str);
            }
            linkStyle.AddAttributesToRender(writer);
            RenderItemHref(owner, writer, item);
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            owner.RenderItemContent(writer, item, isDynamicItem);
            writer.RenderEndTag();

            str = item.SeparatorImageUrl;
            if (String.IsNullOrEmpty(str))
            {
                if (isDynamicItem)
                {
                    str = oc.DynamicBottomSeparatorImageUrl;
                }
                else
                {
                    str = oc.StaticBottomSeparatorImageUrl;
                }
            }
            RenderSeparatorImage(owner, writer, str, true);

            // if (itemLevel == 1)
            //  writer.RenderEndTag (); // </li>

            if (displayChildren)
            {
                owner.RenderMenu(writer, item.ChildItems, vertical, isDynamicItem, itemLevel, notLast);
            }

            if (itemLevel > 0)
            {
                writer.RenderEndTag();                  // </li>
            }
        }
 public void Remove(MenuItemStyle style)
 {
 }
예제 #32
0
        public override void PreRender(Page page, HtmlHead head, ClientScriptManager csm, string cmenu, StringBuilder script)
        {
            Menu                    owner = Owner;
            MenuItemStyle           staticMenuItemStyle     = owner.StaticMenuItemStyleInternal;
            SubMenuStyle            staticMenuStyle         = owner.StaticMenuStyleInternal;
            MenuItemStyle           dynamicMenuItemStyle    = owner.DynamicMenuItemStyleInternal;
            SubMenuStyle            dynamicMenuStyle        = owner.DynamicMenuStyleInternal;
            MenuItemStyleCollection levelMenuItemStyles     = owner.LevelMenuItemStyles;
            List <Style>            levelMenuItemLinkStyles = owner.LevelMenuItemLinkStyles;
            SubMenuStyleCollection  levelSubMenuStyles      = owner.LevelSubMenuStylesInternal;
            MenuItemStyle           staticSelectedStyle     = owner.StaticSelectedStyleInternal;
            MenuItemStyle           dynamicSelectedStyle    = owner.DynamicSelectedStyleInternal;
            MenuItemStyleCollection levelSelectedStyles     = owner.LevelSelectedStylesInternal;
            List <Style>            levelSelectedLinkStyles = owner.LevelSelectedLinkStyles;
            Style                   staticHoverStyle        = owner.StaticHoverStyleInternal;
            Style                   dynamicHoverStyle       = owner.DynamicHoverStyleInternal;

            if (!csm.IsClientScriptIncludeRegistered(typeof(Menu), "Menu.js"))
            {
                string url = csm.GetWebResourceUrl(typeof(Menu), "Menu.js");
                csm.RegisterClientScriptInclude(typeof(Menu), "Menu.js", url);
            }

            script.AppendFormat(onPreRenderScript,
                                cmenu,
                                page.IsMultiForm ? page.theForm : "window",
                                ClientScriptManager.GetScriptLiteral(owner.DisappearAfter),
                                ClientScriptManager.GetScriptLiteral(owner.Orientation == Orientation.Vertical));

            if (owner.DynamicHorizontalOffset != 0)
            {
                script.Append(String.Concat(cmenu, ".dho = ", ClientScriptManager.GetScriptLiteral(owner.DynamicHorizontalOffset), ";\n"));
            }
            if (owner.DynamicVerticalOffset != 0)
            {
                script.Append(String.Concat(cmenu, ".dvo = ", ClientScriptManager.GetScriptLiteral(owner.DynamicVerticalOffset), ";\n"));
            }

            // The order in which styles are defined matters when more than one class
            // is assigned to an element
            RegisterStyle(owner.PopOutBoxStyle, head);
            RegisterStyle(owner.ControlStyle, owner.ControlLinkStyle, head);

            if (staticMenuItemStyle != null)
            {
                RegisterStyle(owner.StaticMenuItemStyle, owner.StaticMenuItemLinkStyle, head);
            }

            if (staticMenuStyle != null)
            {
                RegisterStyle(owner.StaticMenuStyle, head);
            }

            if (dynamicMenuItemStyle != null)
            {
                RegisterStyle(owner.DynamicMenuItemStyle, owner.DynamicMenuItemLinkStyle, head);
            }

            if (dynamicMenuStyle != null)
            {
                RegisterStyle(owner.DynamicMenuStyle, head);
            }

            if (levelMenuItemStyles != null && levelMenuItemStyles.Count > 0)
            {
                levelMenuItemLinkStyles = new List <Style> (levelMenuItemStyles.Count);
                foreach (Style style in levelMenuItemStyles)
                {
                    Style linkStyle = new Style();
                    levelMenuItemLinkStyles.Add(linkStyle);
                    RegisterStyle(style, linkStyle, head);
                }
            }

            if (levelSubMenuStyles != null)
            {
                foreach (Style style in levelSubMenuStyles)
                {
                    RegisterStyle(style, head);
                }
            }

            if (staticSelectedStyle != null)
            {
                RegisterStyle(staticSelectedStyle, owner.StaticSelectedLinkStyle, head);
            }

            if (dynamicSelectedStyle != null)
            {
                RegisterStyle(dynamicSelectedStyle, owner.DynamicSelectedLinkStyle, head);
            }

            if (levelSelectedStyles != null && levelSelectedStyles.Count > 0)
            {
                levelSelectedLinkStyles = new List <Style> (levelSelectedStyles.Count);
                foreach (Style style in levelSelectedStyles)
                {
                    Style linkStyle = new Style();
                    levelSelectedLinkStyles.Add(linkStyle);
                    RegisterStyle(style, linkStyle, head);
                }
            }

            if (staticHoverStyle != null)
            {
                if (head == null)
                {
                    throw new InvalidOperationException("Using Menu.StaticHoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                }
                RegisterStyle(staticHoverStyle, owner.StaticHoverLinkStyle, head);
                script.Append(String.Concat(cmenu, ".staticHover = ", ClientScriptManager.GetScriptLiteral(staticHoverStyle.RegisteredCssClass), ";\n"));
                script.Append(String.Concat(cmenu, ".staticLinkHover = ", ClientScriptManager.GetScriptLiteral(owner.StaticHoverLinkStyle.RegisteredCssClass), ";\n"));
            }

            if (dynamicHoverStyle != null)
            {
                if (head == null)
                {
                    throw new InvalidOperationException("Using Menu.DynamicHoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                }
                RegisterStyle(dynamicHoverStyle, owner.DynamicHoverLinkStyle, head);
                script.Append(String.Concat(cmenu, ".dynamicHover = ", ClientScriptManager.GetScriptLiteral(dynamicHoverStyle.RegisteredCssClass), ";\n"));
                script.Append(String.Concat(cmenu, ".dynamicLinkHover = ", ClientScriptManager.GetScriptLiteral(owner.DynamicHoverLinkStyle.RegisteredCssClass), ";\n"));
            }
        }
 public void CopyTo (MenuItemStyle[] styleArray, int index)
 {
   Contract.Ensures (styleArray.Length >= 0);
 }
예제 #34
0
		public void CopyTo (MenuItemStyle[] array, int index)
		{
			((IList)this).CopyTo (array, index);
		}
예제 #35
0
 public int Add(MenuItemStyle style)
 {
     return(((IList)this).Add(style));
 }
 public int Add(MenuItemStyle style)
 {
   return default(int);
 }
예제 #37
0
		public int IndexOf (MenuItemStyle style)
		{
			return ((IList)this).IndexOf (style);
		}
 public void CopyTo(MenuItemStyle[] styleArray, int index)
 {
 }
예제 #39
0
		public void Insert (int index, MenuItemStyle style)
		{
			((IList)this).Insert (index, style);
		}
 public void Insert(int index, MenuItemStyle style)
 {
 }
예제 #41
0
		public void Remove (MenuItemStyle style)
		{
			((IList)this).Remove (style);
		}
예제 #42
0
		public void Menu_ChangeDefaultProperties ()
		{
			PokerMenu p = new PokerMenu ();
			Button B = new Button ();
			p.Controls.Add (B);
			Assert.AreEqual (1,p.Controls.Count, "ControlsCollection");

			MenuItemBinding M = new MenuItemBinding ();
			M.DataMember = "test";
			M.Depth = 0;
			M.TextField = "title"; 
			M.NavigateUrl="url";
			Object C = p.DataBindings;
			Assert.AreEqual (0, p.DataBindings.Count, "DataBindings#1");
			((MenuItemBindingCollection)C).Add (M);
			Assert.AreEqual (1,p.DataBindings.Count,"DataBindings#2");

			p.DisappearAfter = 100;
			Assert.AreEqual (100, p.DisappearAfter, "DisappearAfter");

			p.DynamicBottomSeparatorImageUrl = "test.aspx";
			Assert.AreEqual ("test.aspx", p.DynamicBottomSeparatorImageUrl, "DynamicBottomSeparatorImageUrl");

			p.DynamicEnableDefaultPopOutImage = false;
			Assert.AreEqual (false,p.DynamicEnableDefaultPopOutImage, "DynamicEnableDefaultPopOutImage");

			p.DynamicHorizontalOffset = 10;
			Assert.AreEqual (10, p.DynamicHorizontalOffset, "DynamicHorizontalOffset");

			p.DynamicHoverStyle.BackColor = Color.Red;
			Assert.AreEqual (Color.Red ,p.DynamicHoverStyle.BackColor, "DynamicHoverStyle");

			p.DynamicItemFormatString = "Mytest";
			Assert.AreEqual ("Mytest", p.DynamicItemFormatString, "DynamicItemFormatString");

			MyWebControl.Image myImage = new MyWebControl.Image ();
			myImage.ImageUrl = "myimage.jpg";
			ImageTemplate Template = new ImageTemplate ();
			Template.MyImage = myImage;
			// end create template image
			p.DynamicItemTemplate = Template;
			Assert.IsNotNull (p.DynamicItemTemplate, "RootNodeTemplate");
			Assert.AreEqual (typeof (ImageTemplate), p.DynamicItemTemplate.GetType (), "RootNodeTemplate#1");

			p.DynamicMenuItemStyle.BackColor = Color.Red;			
			Assert.AreEqual (Color.Red, p.DynamicMenuItemStyle.BackColor, "DynamicMenuItemStyle");

			p.DynamicMenuStyle.BackColor = Color.Red;
			Assert.AreEqual (Color.Red,p.DynamicMenuStyle.BackColor, "DynamicMenuStyle");

			p.DynamicPopOutImageUrl = "test";
			Assert.AreEqual ("test", p.DynamicPopOutImageUrl, "DynamicPopOutImageUrl");

			p.DynamicSelectedStyle.BackColor = Color.Red;
			Assert.AreEqual (Color.Red,p.DynamicSelectedStyle.BackColor, "DynamicSelectedStyle");

			p.DynamicTopSeparatorImageUrl = "test";
			Assert.AreEqual ("test", p.DynamicTopSeparatorImageUrl, "DynamicTopSeparatorImageUrl");

			p.DynamicVerticalOffset = 10;
			Assert.AreEqual (10, p.DynamicVerticalOffset, "DynamicVerticalOffset");

			MenuItem I = new MenuItem ();
			I.NavigateUrl = "default.aspx";
			I.Text = "MyText";
			I.ToolTip = "Test";
			p.Items.Add (I);
			Assert.AreEqual (1, p.Items.Count, "Items");

			p.ItemWrap = true;
			Assert.AreEqual (true, p.ItemWrap, "ItemWrap");

			MenuItemStyle S = new MenuItemStyle ();
			S.BackColor = Color.Red;
			p.LevelSelectedStyles.Add (S);
			Assert.AreEqual (1,p.LevelSelectedStyles.Count , "LevelSelectedStyles#1");
			Assert.AreEqual (true, p.LevelSelectedStyles.Contains (S), "LevelSelectedStyles#2");

			SubMenuStyle SM = new SubMenuStyle ();
			SM.BackColor = Color.Red;
			p.LevelSubMenuStyles.Add (SM);
			Assert.AreEqual(1, p.LevelSubMenuStyles.Count, "LevelSubMenuStyles#1");
			Assert.AreEqual (true, p.LevelSubMenuStyles.Contains (SM), "LevelSubMenuStyles#2");

			p.MaximumDynamicDisplayLevels = 5; 
			Assert.AreEqual (5, p.MaximumDynamicDisplayLevels, "MaximumDynamicDisplayLevels");

			p.Orientation = Orientation.Horizontal;
			Assert.AreEqual (Orientation.Horizontal, p.Orientation, "Orientation");

			p.PathSeparator = 'A';
			Assert.AreEqual ('A', p.PathSeparator, "PathSeparator");

			p.ScrollDownImageUrl = "test";
			Assert.AreEqual ("test", p.ScrollDownImageUrl, "ScrollDownImageUrl");

			p.ScrollDownText = "test";
			Assert.AreEqual ("test", p.ScrollDownText, "ScrollDownText");

			// This properties will be checked in events part of tests
			// Assert.AreEqual (0, p.SelectedItem, "p.SelectedItem");
			// Assert.AreEqual (string.Empty, p.SelectedValue, "SelectedValue");

			p.SkipLinkText = "test";
			Assert.AreEqual ("test", p.SkipLinkText, "SkipLinkText");

			p.StaticBottomSeparatorImageUrl = "test";
			Assert.AreEqual ("test", p.StaticBottomSeparatorImageUrl, "StaticBottomSeparatorImageUrl");

			p.StaticDisplayLevels = 2;
			Assert.AreEqual (2, p.StaticDisplayLevels, "StaticDisplayLevels");

			p.StaticEnableDefaultPopOutImage = false;
			Assert.AreEqual (false, p.StaticEnableDefaultPopOutImage, "StaticEnableDefaultPopOutImage");

			p.StaticHoverStyle.BackColor = Color.Red;
			Assert.AreEqual(Color.Red, p.StaticHoverStyle.BackColor, "StaticHoverStyle");

			p.StaticItemFormatString = "test";
			Assert.AreEqual ("test", p.StaticItemFormatString, "StaticItemFormatString");

			
			p.StaticItemTemplate = Template;
			Assert.IsNotNull (p.StaticItemTemplate, "StaticItemTemplate");

			p.StaticMenuItemStyle.BackColor = Color.Red;
			Assert.AreEqual(Color.Red,p.StaticMenuItemStyle.BackColor, "StaticMenuItemStyle");

			p.StaticMenuStyle.BackColor = Color.Red;
			Assert.AreEqual (Color.Red,p.StaticMenuStyle.BackColor, "StaticMenuStyle");

			p.StaticPopOutImageUrl = "test";
			Assert.AreEqual ("test", p.StaticPopOutImageUrl, "StaticPopOutImageUrl");

			p.StaticSelectedStyle.BackColor = Color.Red;
			Assert.AreEqual(Color.Red,p.StaticSelectedStyle.BackColor, "StaticSelectedStyle");

			p.StaticSubMenuIndent = 20;
			Assert.AreEqual (Unit.Pixel (20), p.StaticSubMenuIndent, "StaticSubMenuIndent");

			p.StaticTopSeparatorImageUrl = "test";
			Assert.AreEqual ("test", p.StaticTopSeparatorImageUrl, "StaticTopSeparatorImageUrl");

			p.Target = "test";
			Assert.AreEqual ("test", p.Target, "Target");
		}
 private void RenderStyle(HtmlTextWriter writer, WebControl control, string className, MenuItemStyle style, bool applyInlineBorder)
 {
     if (!string.IsNullOrEmpty(className))
     {
         control.CssClass = className;
         if (applyInlineBorder)
         {
             writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "none");
             writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "1em");
         }
     }
     else if (style != null)
     {
         control.ApplyStyle(style);
     }
 }