コード例 #1
0
        /// <devdoc>
        ///    Copies non-blank elements from the specified style, but will not overwrite
        ///    any existing style elements.
        /// </devdoc>
        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);

                SubMenuStyle sms = s as SubMenuStyle;
                // 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 (sms != null && !sms.IsEmpty && s.RegisteredCssClass.Length == 0)
                {
                    if (sms.IsSet(PROP_VPADDING) && !this.IsSet(PROP_VPADDING))
                    {
                        this.VerticalPadding = sms.VerticalPadding;
                    }

                    if (sms.IsSet(PROP_HPADDING) && !this.IsSet(PROP_HPADDING))
                    {
                        this.HorizontalPadding = sms.HorizontalPadding;
                    }
                }
            }
        }
コード例 #2
0
        public override void CopyFrom(Style s)
        {
            if (s == null || s.IsEmpty)
            {
                return;
            }

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

            if (from == null)
            {
                return;
            }

            if (from.IsSet(HORZ_PADD))
            {
                HorizontalPadding = from.HorizontalPadding;
            }

            if (from.IsSet(VERT_PADD))
            {
                VerticalPadding = from.VerticalPadding;
            }
        }
コード例 #3
0
 public override void MergeWith(Style s)
 {
     if (s != null)
     {
         if (this.IsEmpty)
         {
             this.CopyFrom(s);
         }
         else
         {
             base.MergeWith(s);
             SubMenuStyle style = s as SubMenuStyle;
             if (((style != null) && !style.IsEmpty) && (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;
                 }
             }
         }
     }
 }
コード例 #4
0
 public override void CopyFrom(Style s)
 {
     if (s != null)
     {
         base.CopyFrom(s);
         SubMenuStyle style = s as SubMenuStyle;
         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;
                 }
             }
         }
     }
 }
コード例 #5
0
        public override void MergeWith(Style s)
        {
            if (s != null && !s.IsEmpty)
            {
                if (IsEmpty)
                {
                    CopyFrom(s);
                    return;
                }
                base.MergeWith(s);

                SubMenuStyle with = s as SubMenuStyle;
                if (with == null)
                {
                    return;
                }

                if (with.IsSet(HORZ_PADD) && !IsSet(HORZ_PADD))
                {
                    HorizontalPadding = with.HorizontalPadding;
                }
                if (with.IsSet(VERT_PADD) && !IsSet(VERT_PADD))
                {
                    VerticalPadding = with.VerticalPadding;
                }
            }
        }
コード例 #6
0
 public BaseMenu(string clientId, bool isRightToLeft, Action<HtmlTextWriter, MenuItem, int> renderDynamicItem, SubMenuStyle dynamicMenuStyle, Style dynamicMenuItemStyle, Style dynamicHoverStyle)
 {
     IsRightToLeft = isRightToLeft;
     this.renderDynamicItem = renderDynamicItem;
     DynamicMenuItemStyle = dynamicMenuItemStyle;
     DynamicHoverStyle = dynamicHoverStyle;
     DynamicMenuStyle = dynamicMenuStyle;
     ClientID = clientId;
 }
コード例 #7
0
 public override void RenderMenuBeginTag(HtmlTextWriter writer, bool dynamic, int menuLevel)
 {
     if (dynamic || menuLevel == 0)
     {
         var style = new SubMenuStyle();
         AddCssClass(style, "level" + (menuLevel + 1));
         FillMenuStyle(null, dynamic, menuLevel, style);
         style.AddAttributesToRender(writer);
         writer.RenderBeginTag(HtmlTextWriterTag.Ul);
     }
 }
コード例 #8
0
        protected override void OnInsert(int index, object value)
        {
            base.OnInsert(index, value);
            if (!(value is SubMenuStyle))
            {
                throw new ArgumentException(System.Web.SR.GetString("SubMenuStyleCollection_InvalidArgument"), "value");
            }
            SubMenuStyle style = (SubMenuStyle)value;

            style.Font.Underline = style.Font.Underline;
        }
コード例 #9
0
        void RenderMenuBeginTagAttributes(HtmlTextWriter writer, bool dynamic, int menuLevel)
        {
            writer.AddAttribute("cellpadding", "0", false);
            writer.AddAttribute("cellspacing", "0", false);
            writer.AddAttribute("border", "0", false);

            if (!dynamic)
            {
                SubMenuStyle style = new SubMenuStyle();
                FillMenuStyle(null, dynamic, menuLevel, style);
                style.AddAttributesToRender(writer);
            }
        }
コード例 #10
0
        public void FillMenuStyle(HtmlHead header, bool dynamic, int menuLevel, SubMenuStyle style)
        {
            Menu owner = Owner;

            if (header == null)
            {
                Page page = owner.Page;
                header = page != null ? page.Header : null;
            }

            SubMenuStyle staticMenuStyle = owner.StaticMenuStyleInternal;
//			MenuItemStyle dynamicMenuItemStyle = owner.DynamicMenuItemStyleInternal;
            SubMenuStyle           dynamicMenuStyle   = owner.DynamicMenuStyleInternal;
            SubMenuStyleCollection levelSubMenuStyles = owner.LevelSubMenuStylesInternal;

            if (header != null)
            {
                // styles are registered
                if (!dynamic && staticMenuStyle != null)
                {
                    AddCssClass(style, staticMenuStyle.CssClass);
                    AddCssClass(style, staticMenuStyle.RegisteredCssClass);
                }
                if (dynamic && dynamicMenuStyle != null)
                {
                    AddCssClass(style, dynamicMenuStyle.CssClass);
                    AddCssClass(style, dynamicMenuStyle.RegisteredCssClass);
                }
                if (levelSubMenuStyles != null && levelSubMenuStyles.Count > menuLevel)
                {
                    AddCssClass(style, levelSubMenuStyles [menuLevel].CssClass);
                    AddCssClass(style, levelSubMenuStyles [menuLevel].RegisteredCssClass);
                }
            }
            else
            {
                // styles are not registered
                if (!dynamic && staticMenuStyle != null)
                {
                    style.CopyFrom(staticMenuStyle);
                }
                if (dynamic && dynamicMenuStyle != null)
                {
                    style.CopyFrom(dynamicMenuStyle);
                }
                if (levelSubMenuStyles != null && levelSubMenuStyles.Count > menuLevel)
                {
                    style.CopyFrom(levelSubMenuStyles [menuLevel]);
                }
            }
        }
コード例 #11
0
            public override void RenderBeginTag(HtmlTextWriter writer, bool staticOnly)
            {
                ControlRenderingHelper.WriteSkipLinkStart(writer, Menu.RenderingCompatibility, Menu.DesignMode, Menu.SkipLinkText, Menu.SpacerImageUrl, Menu.ClientID);

                // <table cellpadding="0" cellspacing="0" border="0" height="nodespacing">
                // Determine root menu style
                // First initialize the root menu style that depends on the control style before we change it. (VSWhidbey 354878)
                Menu.EnsureRootMenuStyle();
                if (Menu.Font != null)
                {
                    // Relative sizes should not be multiplied (VSWhidbey 457610)
                    Menu.Font.Reset();
                }
                Menu.ForeColor = Color.Empty;
                SubMenuStyle rootMenuStyle = Menu.GetSubMenuStyle(Menu.RootItem);

                if (Menu.Page != null && Menu.Page.SupportsStyleSheets)
                {
                    string styleClass = Menu.GetSubMenuCssClassName(Menu.RootItem);
                    if (styleClass.Length > 0)
                    {
                        if (Menu.CssClass.Length == 0)
                        {
                            Menu.CssClass = styleClass;
                        }
                        else
                        {
                            Menu.CssClass += ' ' + styleClass;
                        }
                    }
                }
                else
                {
                    if (rootMenuStyle != null && !rootMenuStyle.IsEmpty)
                    {
                        // Remove FontInfo and ForeColor from the submenustyle where they are not relevant
                        // but may get copied from by ControlStyle (VSWhidbey 438980)
                        rootMenuStyle.Font.Reset();
                        rootMenuStyle.ForeColor = Color.Empty;
                        // It's ok to change the control style at this point because viewstate has already been saved
                        Menu.ControlStyle.CopyFrom(rootMenuStyle);
                    }
                }

                Menu.AddAttributesToRender(writer);

                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
            }
コード例 #12
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);

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

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

                        if (sms.IsSet(PROP_HPADDING))
                        {
                            this.HorizontalPadding = sms.HorizontalPadding;
                        }
                    }
                }
            }
        }
コード例 #13
0
        public virtual void AddAttributesToRender(HtmlTextWriter writer)
        {
            Menu                   owner              = Owner;
            Page                   page               = owner.Page;
            SubMenuStyle           staticMenuStyle    = owner.StaticMenuStyleInternal;
            SubMenuStyleCollection levelSubMenuStyles = owner.LevelSubMenuStylesInternal;
            bool                   haveSubStyles      = levelSubMenuStyles != null && levelSubMenuStyles.Count > 0;
            Style                  controlStyle       = haveSubStyles || staticMenuStyle != null ? owner.ControlStyle : null;

            if (page != null && page.Header != null)
            {
                // styles are registered
                if (staticMenuStyle != null)
                {
                    AddCssClass(controlStyle, staticMenuStyle.CssClass);
                    AddCssClass(controlStyle, staticMenuStyle.RegisteredCssClass);
                }
                if (haveSubStyles)
                {
                    AddCssClass(controlStyle, levelSubMenuStyles [0].CssClass);
                    AddCssClass(controlStyle, levelSubMenuStyles [0].RegisteredCssClass);
                }
            }
            else
            {
                // styles are not registered
                if (staticMenuStyle != null)
                {
                    controlStyle.CopyFrom(staticMenuStyle);
                }
                if (haveSubStyles)
                {
                    controlStyle.CopyFrom(levelSubMenuStyles [0]);
                }
            }
        }
 public void CopyTo(SubMenuStyle[] styleArray, int index)
 {
 }
 public int Add(SubMenuStyle style)
 {
   return default(int);
 }
コード例 #16
0
 public void Remove(SubMenuStyle style) {
     ((IList)this).Remove(style);
 }
コード例 #17
0
 public int IndexOf(SubMenuStyle style) {
     return ((IList)this).IndexOf(style);
 }
コード例 #18
0
		public void CopyTo (SubMenuStyle[] array, int index)
		{
			((IList)this).CopyTo (array, index);
		}
コード例 #19
0
 public void Insert(int index, SubMenuStyle style)
 {
     ((IList)this).Insert(index, style);
 }
 public void CopyTo (SubMenuStyle[] styleArray, int index)
 {
   Contract.Ensures (styleArray.Length >= 0);
 }
コード例 #21
0
        public override void PreRender(Page page, HtmlHead head, ClientScriptManager csm, string cmenu, StringBuilder script)
        {
            Menu owner = Owner;

            script.AppendFormat("new Sys.WebForms.Menu ({{ element: '{0}', disappearAfter: {1}, orientation: '{2}', tabIndex: {3}, disabled: {4} }});",
                                owner.ClientID,
                                ClientScriptManager.GetScriptLiteral(owner.DisappearAfter),
                                owner.Orientation.ToString().ToLowerInvariant(),
                                ClientScriptManager.GetScriptLiteral(owner.TabIndex),
                                (!owner.Enabled).ToString().ToLowerInvariant());

            Type mt = typeof(Menu);

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

            if (!owner.IncludeStyleBlock)
            {
                return;
            }

            if (head == null)
            {
                throw new InvalidOperationException("Using Menu.IncludeStyleBlock requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
            }

            StyleBlock block      = new StyleBlock(owner.ClientID);
            Style      style      = owner.ControlStyle;
            bool       horizontal = owner.Orientation == Orientation.Horizontal;

            if (style != null)
            {
                block.RegisterStyle(style);
            }

            // #MenuId img.icon { border-style:none;vertical-align:middle; }
            block.RegisterStyle(HtmlTextWriterStyle.BorderStyle, "none", "img.icon")
            .Add(HtmlTextWriterStyle.VerticalAlign, "middle");

            // #MenuId img.separator { border-style:none;display:block; }
            block.RegisterStyle(HtmlTextWriterStyle.BorderStyle, "none", "img.separator")
            .Add(HtmlTextWriterStyle.Display, "block");

            // #MenuId img.horizontal-separator { border-style:none;vertical-align:middle; }
            if (horizontal)
            {
                block.RegisterStyle(HtmlTextWriterStyle.BorderStyle, "none", "img.horizontal-separator")
                .Add(HtmlTextWriterStyle.VerticalAlign, "middle");
            }

            // #MenuId ul { list-style:none;margin:0;padding:0;width:auto; }
            block.RegisterStyle(HtmlTextWriterStyle.ListStyleType, "none", "ul")
            .Add(HtmlTextWriterStyle.Margin, "0")
            .Add(HtmlTextWriterStyle.Padding, "0")
            .Add(HtmlTextWriterStyle.Width, "auto");

            SubMenuStyle sms = owner.StaticMenuStyleInternal;

            if (sms != null)
            {
                // #MenuId ul.static { ... }
                block.RegisterStyle(sms, "ul.static");
            }

            // #MenuId ul.dynamic { ...; z-index:1; ... }
            NamedCssStyleCollection css = block.RegisterStyle("ul.dynamic");

            sms = owner.DynamicMenuStyleInternal;
            if (sms != null)
            {
                sms.ForeColor = Color.Empty;
                css.Add(sms);
            }

            css.Add(HtmlTextWriterStyle.ZIndex, "1");
            int num = owner.DynamicHorizontalOffset;

            if (num != 0)
            {
                css.Add(HtmlTextWriterStyle.MarginLeft, num + "px");
            }
            num = owner.DynamicVerticalOffset;
            if (num != 0)
            {
                css.Add(HtmlTextWriterStyle.MarginTop, num + "px");
            }

            // BUG: rendering of LevelSubMenuStyles throws InvalidCastException on .NET
            // but I suspect the code it is supposed to generate is as follows:
            //
            // #MenuId ul.levelX { ... }
            //
            // so we will just ignore the bug and go with the above code.
            RenderLevelStyles(block, num, owner.LevelSubMenuStyles, "ul.level");

            // #MenuId a { text-decoration:none;white-space:nowrap;display:block; }
            block.RegisterStyle(HtmlTextWriterStyle.TextDecoration, "none", "a")
            .Add(HtmlTextWriterStyle.WhiteSpace, "nowrap")
            .Add(HtmlTextWriterStyle.Display, "block");

            // #MenuId a.static { ... }
            RenderAnchorStyle(block, owner.StaticMenuItemStyleInternal, "a.static");

            // #MenuId a.popout { background-image:url("...");background-repeat:no-repeat;background-position:right center;padding-right:14px; }
            bool   needDynamicPopOut = false;
            string str = owner.StaticPopOutImageUrl;

            css = null;
            string urlFormat = "url(\"{0}\")";

            if (String.IsNullOrEmpty(str))
            {
                if (owner.StaticEnableDefaultPopOutImage)
                {
                    css = block.RegisterStyle(HtmlTextWriterStyle.BackgroundImage, String.Format(urlFormat, GetArrowResourceUrl(owner)), "a.popout");
                }
                else
                {
                    needDynamicPopOut = true;
                }
            }
            else
            {
                css = block.RegisterStyle(HtmlTextWriterStyle.BackgroundImage, String.Format(urlFormat, str), "a.popout");
                needDynamicPopOut = true;
            }

            if (css != null)
            {
                css.Add("background-repeat", "no-repeat")
                .Add("background-position", "right center")
                .Add(HtmlTextWriterStyle.PaddingRight, "14px");
            }

            // #MenuId a.popout-dynamic { background:url("...") no-repeat right center;padding-right:14px; }
            str = owner.DynamicPopOutImageUrl;
            bool haveDynamicUrl = !String.IsNullOrEmpty(str);

            css = null;
            if (needDynamicPopOut || haveDynamicUrl)
            {
                urlFormat = "url(\"{0}\") no-repeat right center";
                if (!haveDynamicUrl)
                {
                    if (owner.DynamicEnableDefaultPopOutImage)
                    {
                        css = block.RegisterStyle(HtmlTextWriterStyle.BackgroundImage, String.Format(urlFormat, GetArrowResourceUrl(owner)), "a.popout-dynamic");
                    }
                }
                else
                {
                    css = block.RegisterStyle(HtmlTextWriterStyle.BackgroundImage, String.Format(urlFormat, str), "a.popout-dynamic");
                }
            }
            if (css != null)
            {
                haveDynamicPopOut = true;
                css.Add(HtmlTextWriterStyle.PaddingRight, "14px");
            }

            // #MenuId a.dynamic { ... }
            RenderAnchorStyle(block, owner.DynamicMenuItemStyleInternal, "a.dynamic");

            num = owner.StaticDisplayLevels;
            Unit   ssmi = owner.StaticSubMenuIndent;
            string unitName;
            double indent;

            if (ssmi == Unit.Empty)
            {
                unitName = "em";
                indent   = 1;
            }
            else
            {
                unitName = Unit.GetExtension(ssmi.Type);
                indent   = ssmi.Value;
            }

            // #MenuId a.levelX { ... }
            RenderLevelStyles(block, num, owner.LevelMenuItemStyles, "a.level", unitName, indent);

            // #MenuId a.selected.levelX { ... }
            RenderLevelStyles(block, num, owner.LevelSelectedStyles, "a.selected.level");

            // #MenuId a.static.selected { ...;text-decoration:none; }
            RenderAnchorStyle(block, owner.StaticSelectedStyleInternal, "a.static.selected");

            // #MenuId a.dynamic.selected { ...;text-decoration:none;border-style:none; }
            RenderAnchorStyle(block, owner.DynamicSelectedStyleInternal, "a.dynamic.selected");

            // #MenuId a.static.highlighted { ... }
            style = owner.StaticHoverStyleInternal;
            if (style != null)
            {
                block.RegisterStyle(style, "a.static.highlighted");
            }

            // #MenuId a.dynamic.highlighted { ... }
            style = owner.DynamicHoverStyleInternal;
            if (style != null)
            {
                block.RegisterStyle(style, "a.dynamic.highlighted");
            }

            head.Controls.Add(block);
        }
コード例 #22
0
		string GetCssMenuStyle (bool dynamic, int menuLevel)
		{
			if (Page.Header != null) {
				// styles are registered
				StringBuilder sb = new StringBuilder ();

				if (!dynamic && staticMenuStyle != null) {
					sb.Append (staticMenuStyle.CssClass);
					sb.Append (' ');
					sb.Append (staticMenuStyle.RegisteredCssClass);
				}
				if (dynamic && dynamicMenuStyle != null) {
					sb.Append (PopOutBoxStyle.RegisteredCssClass);
					sb.Append (' ');
					sb.Append (dynamicMenuStyle.CssClass);
					sb.Append (' ');
					sb.Append (dynamicMenuStyle.RegisteredCssClass);
				}
				if (levelSubMenuStyles != null && levelSubMenuStyles.Count > menuLevel) {
					sb.Append (levelSubMenuStyles [menuLevel].CssClass);
					sb.Append (' ');
					sb.Append (levelSubMenuStyles [menuLevel].RegisteredCssClass); 
				}
				return sb.ToString ();
			}
			else {
				// styles are not registered
				SubMenuStyle style = new SubMenuStyle ();

				if (!dynamic && staticMenuStyle != null) {
					style.CopyFrom (staticMenuStyle);
				}
				if (dynamic && dynamicMenuStyle != null) {
					style.CopyFrom (PopOutBoxStyle);
					style.CopyFrom (dynamicMenuStyle);
				}
				if (levelSubMenuStyles != null && levelSubMenuStyles.Count > menuLevel) {
					style.CopyFrom (levelSubMenuStyles [menuLevel]);
				}
				return style.GetStyleAttributes (null).Value;
			}
		}
コード例 #23
0
ファイル: MenuListRenderer.cs プロジェクト: alisci01/mono
		public override void RenderMenuBeginTag (HtmlTextWriter writer, bool dynamic, int menuLevel)
		{
			if (dynamic || menuLevel == 0) {
				var style = new SubMenuStyle ();
				AddCssClass (style, "level" + (menuLevel + 1));
				FillMenuStyle (null, dynamic, menuLevel, style);
				style.AddAttributesToRender (writer);
				writer.RenderBeginTag (HtmlTextWriterTag.Ul);
			}
		}
 public void Insert(int index, SubMenuStyle style)
 {
 }
コード例 #25
0
ファイル: ContextMenu.cs プロジェクト: egarciac/SwissKipTeam
 public ContextMenu(string clientId, bool isRightToLeft, Action<HtmlTextWriter, MenuItem, int> renderDynamicItem, SubMenuStyle dynamicMenuStyle, Style dynamicMenuItemStyle, Style dynamicHoverStyle)
     : base(clientId, isRightToLeft, renderDynamicItem, dynamicMenuStyle, dynamicMenuItemStyle, dynamicHoverStyle)
 {
 }
コード例 #26
0
ファイル: ToolbarMenu.cs プロジェクト: egarciac/SwissKipTeam
 public ToolbarMenu(string clientId, bool isRightToLeft, Action<HtmlTextWriter, MenuItem, int> renderToolbarItem, Action<HtmlTextWriter, MenuItem, int> renderDynamicItem, SubMenuStyle dynamicMenuStyle, Style dynamicMenuItemStyle, Style dynamicHoverStyle)
     : base(clientId, isRightToLeft, renderDynamicItem, dynamicMenuStyle, dynamicMenuItemStyle, dynamicHoverStyle)
 {
     this.renderToolbarItem = renderToolbarItem;
 }
コード例 #27
0
 public void Remove(SubMenuStyle style)
 {
     ((IList)this).Remove(style);
 }
コード例 #28
0
 public int Add(SubMenuStyle style) {
     return ((IList)this).Add(style);
 }
コード例 #29
0
		void RenderMenuBeginTagAttributes (HtmlTextWriter writer, bool dynamic, int menuLevel) {
			writer.AddAttribute ("cellpadding", "0", false);
			writer.AddAttribute ("cellspacing", "0", false);
			writer.AddAttribute ("border", "0", false);

			if (!dynamic) {
				SubMenuStyle style = new SubMenuStyle ();
				FillMenuStyle (dynamic, menuLevel, style);
				style.AddAttributesToRender (writer);
			}
		}
コード例 #30
0
        internal void Render(HtmlTextWriter writer, bool enabled, bool staticOnly, bool recursive)
        {
            enabled = enabled && this.Enabled;
            int num = this.Depth + 1;

            if ((this.ChildItems.Count > 0) && (num < this._owner.MaximumDepth))
            {
                SubMenuStyle subMenuStyle        = this._owner.GetSubMenuStyle(this);
                string       subMenuCssClassName = null;
                if ((this._owner.Page != null) && this._owner.Page.SupportsStyleSheets)
                {
                    subMenuCssClassName = this._owner.GetSubMenuCssClassName(this);
                }
                if (num >= this._owner.StaticDisplayLevels)
                {
                    if ((!staticOnly && enabled) && (!this._owner.DesignMode || !recursive))
                    {
                        PopOutPanel panel = this._owner.Panel;
                        if ((this._owner.Page != null) && this._owner.Page.SupportsStyleSheets)
                        {
                            panel.ScrollerClass = this._owner.GetCssClassName(this.ChildItems[0], false);
                            panel.ScrollerStyle = null;
                        }
                        else
                        {
                            panel.ScrollerClass = null;
                            panel.ScrollerStyle = this._owner.GetMenuItemStyle(this.ChildItems[0]);
                        }
                        if ((this._owner.Page != null) && this._owner.Page.SupportsStyleSheets)
                        {
                            panel.CssClass = subMenuCssClassName;
                            panel.SetInternalStyle(null);
                        }
                        else if (!subMenuStyle.IsEmpty)
                        {
                            panel.CssClass = string.Empty;
                            panel.SetInternalStyle(subMenuStyle);
                        }
                        else
                        {
                            panel.CssClass = string.Empty;
                            panel.SetInternalStyle(null);
                            panel.BackColor = Color.Empty;
                        }
                        panel.ID = this.Id + "Items";
                        panel.RenderBeginTag(writer);
                        writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                        writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                        writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                        writer.RenderBeginTag(HtmlTextWriterTag.Table);
                        for (int i = 0; i < this.ChildItems.Count; i++)
                        {
                            this.ChildItems[i].RenderItem(writer, i, enabled, Orientation.Vertical);
                        }
                        writer.RenderEndTag();
                        panel.RenderEndTag(writer);
                        if (recursive)
                        {
                            for (int j = 0; j < this.ChildItems.Count; j++)
                            {
                                this.ChildItems[j].Render(writer, enabled, false);
                            }
                        }
                    }
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                    writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                    writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                    writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                    if ((this._owner.Page != null) && this._owner.Page.SupportsStyleSheets)
                    {
                        if ((subMenuCssClassName != null) && (subMenuCssClassName.Length > 0))
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, subMenuCssClassName);
                        }
                    }
                    else
                    {
                        subMenuStyle.AddAttributesToRender(writer);
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Table);
                    if (this._owner.Orientation == Orientation.Horizontal)
                    {
                        writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    }
                    bool flag  = (num + 1) < this._owner.StaticDisplayLevels;
                    bool flag2 = (num + 1) < this._owner.MaximumDepth;
                    for (int k = 0; k < this.ChildItems.Count; k++)
                    {
                        if (((recursive && (this.ChildItems[k].ChildItems.Count != 0)) && ((enabled && this.ChildItems[k].Enabled) || flag)) && flag2)
                        {
                            if (flag)
                            {
                                this.ChildItems[k].RenderItem(writer, k, enabled, this._owner.Orientation);
                                if (this._owner.Orientation == Orientation.Vertical)
                                {
                                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                                    this.ChildItems[k].Render(writer, enabled, staticOnly);
                                    writer.RenderEndTag();
                                    writer.RenderEndTag();
                                }
                                else
                                {
                                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                                    this.ChildItems[k].Render(writer, enabled, staticOnly);
                                    writer.RenderEndTag();
                                }
                            }
                            else
                            {
                                this.ChildItems[k].RenderItem(writer, k, enabled, this._owner.Orientation, staticOnly);
                            }
                        }
                        else
                        {
                            this.ChildItems[k].RenderItem(writer, k, enabled, this._owner.Orientation);
                        }
                    }
                    if (this._owner.Orientation == Orientation.Horizontal)
                    {
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag();
                    if ((!flag && !staticOnly) && (recursive && flag2))
                    {
                        for (int m = 0; m < this.ChildItems.Count; m++)
                        {
                            if (((this.ChildItems[m].ChildItems.Count != 0) && enabled) && this.ChildItems[m].Enabled)
                            {
                                this.ChildItems[m].Render(writer, enabled, false, true);
                            }
                        }
                    }
                }
            }
        }
コード例 #31
0
        public FileManagerController()
        {
            DynamicMenuItemStyle = new Style();
            DynamicMenuItemStyle.ForeColor = Color.Black;
            DynamicMenuItemStyle.Font.Names = new[] { "Tahoma", "Verdana", "Geneva", "Arial", "Helvetica", "sans-serif" };
            DynamicMenuItemStyle.Font.Size = FontUnit.Parse("11px", null);

            DynamicHoverStyle = new Style();
            DynamicHoverStyle.ForeColor = Color.White;
            DynamicHoverStyle.BackColor = Color.FromArgb(0x316AC5);

            DynamicMenuStyle = new SubMenuStyle();
            DynamicMenuStyle.BackColor = Color.White;
            DynamicMenuStyle.BorderStyle = BorderStyle.Solid;
            DynamicMenuStyle.BorderWidth = Unit.Pixel(1);
            DynamicMenuStyle.BorderColor = Color.FromArgb(0xACA899);
            DynamicMenuStyle.HorizontalPadding = Unit.Pixel(2);
            DynamicMenuStyle.VerticalPadding = Unit.Pixel(2);
        }
コード例 #32
0
		void FillMenuStyle (bool dynamic, int menuLevel, SubMenuStyle style) {
			if (Page.Header != null) {
				// styles are registered
				if (!dynamic && staticMenuStyle != null) {
					AddCssClass (style, staticMenuStyle.CssClass);
					AddCssClass (style, staticMenuStyle.RegisteredCssClass);
				}
				if (dynamic && dynamicMenuStyle != null) {
					AddCssClass (style, dynamicMenuStyle.CssClass);
					AddCssClass (style, dynamicMenuStyle.RegisteredCssClass);
				}
				if (levelSubMenuStyles != null && levelSubMenuStyles.Count > menuLevel) {
					AddCssClass (style, levelSubMenuStyles [menuLevel].CssClass);
					AddCssClass (style, levelSubMenuStyles [menuLevel].RegisteredCssClass);
				}
			}
			else {
				// styles are not registered
				if (!dynamic && staticMenuStyle != null) {
					style.CopyFrom (staticMenuStyle);
				}
				if (dynamic && dynamicMenuStyle != null) {
					style.CopyFrom (dynamicMenuStyle);
				}
				if (levelSubMenuStyles != null && levelSubMenuStyles.Count > menuLevel) {
					style.CopyFrom (levelSubMenuStyles [menuLevel]);
				}
			}
		}
    public int IndexOf (SubMenuStyle style)
    {
      Contract.Ensures (Contract.Result<int>() >= -1);

      return default(int);
    }
 public int Add(SubMenuStyle style)
 {
     return(default(int));
 }
コード例 #35
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 bool Contains(SubMenuStyle style)
 {
     return(default(bool));
 }
コード例 #37
0
ファイル: BaseMenuRenderer.cs プロジェクト: Profit0004/mono
		public void FillMenuStyle (HtmlHead header, bool dynamic, int menuLevel, SubMenuStyle style)
		{
			Menu owner = Owner;
			if (header == null) {
				Page page = owner.Page;
				header = page != null ? page.Header : null;
			}
			
			SubMenuStyle staticMenuStyle = owner.StaticMenuStyleInternal;
//			MenuItemStyle dynamicMenuItemStyle = owner.DynamicMenuItemStyleInternal;
			SubMenuStyle dynamicMenuStyle = owner.DynamicMenuStyleInternal;
			SubMenuStyleCollection levelSubMenuStyles = owner.LevelSubMenuStylesInternal;
			
			if (header != null) {
				// styles are registered
				if (!dynamic && staticMenuStyle != null) {
					AddCssClass (style, staticMenuStyle.CssClass);
					AddCssClass (style, staticMenuStyle.RegisteredCssClass);
				}
				if (dynamic && dynamicMenuStyle != null) {
					AddCssClass (style, dynamicMenuStyle.CssClass);
					AddCssClass (style, dynamicMenuStyle.RegisteredCssClass);
				}
				if (levelSubMenuStyles != null && levelSubMenuStyles.Count > menuLevel) {
					AddCssClass (style, levelSubMenuStyles [menuLevel].CssClass);
					AddCssClass (style, levelSubMenuStyles [menuLevel].RegisteredCssClass);
				}
			} else {
				// styles are not registered
				if (!dynamic && staticMenuStyle != null)
					style.CopyFrom (staticMenuStyle);
				if (dynamic && dynamicMenuStyle != null)
					style.CopyFrom (dynamicMenuStyle);
				if (levelSubMenuStyles != null && levelSubMenuStyles.Count > menuLevel)
					style.CopyFrom (levelSubMenuStyles [menuLevel]);
			}
		}
 public int IndexOf(SubMenuStyle style)
 {
     return(default(int));
 }
コード例 #39
0
 public bool Contains(SubMenuStyle style) {
     return ((IList)this).Contains(style);
 }
 public void Insert(int index, SubMenuStyle style)
 {
 }
コード例 #41
0
 public void Insert(int index, SubMenuStyle style) {
     ((IList)this).Insert(index, style);
 }
 public void Remove(SubMenuStyle style)
 {
 }
コード例 #43
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");
		}
コード例 #44
0
 public int Add(SubMenuStyle style)
 {
     return(((IList)this).Add(style));
 }
 public bool Contains(SubMenuStyle style)
 {
   return default(bool);
 }
コード例 #46
0
 public bool Contains(SubMenuStyle style)
 {
     return(((IList)this).Contains(style));
 }
 public int IndexOf(SubMenuStyle style)
 {
   return default(int);
 }
コード例 #48
0
 public int IndexOf(SubMenuStyle style)
 {
     return(((IList)this).IndexOf(style));
 }
 public void Remove(SubMenuStyle style)
 {
 }
コード例 #50
0
        public int IndexOf(SubMenuStyle style)
        {
            Contract.Ensures(Contract.Result <int>() >= -1);

            return(default(int));
        }