Exemple #1
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);
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
 public PopOutPanelStyle(PopOutPanel owner)
 {
     _owner = owner;
 }
 public PopOutPanelStyle(PopOutPanel owner) {
     _owner = owner;
 }