Exemplo n.º 1
0
        public void RenderButton(ToolbarButton button, ToolbarButtonFlags flags)
        {
            flags |= button.Flags;
            bool flag  = ToolbarButtonFlags.Tab == (flags & ToolbarButtonFlags.Tab);
            bool flag2 = ToolbarButtonFlags.NoAction == (flags & ToolbarButtonFlags.NoAction);

            if (flag2)
            {
                this.writer.Write("<td nowrap><div class=\"divNoRR\">");
                if ((flags & ToolbarButtonFlags.Image) != (ToolbarButtonFlags)0U)
                {
                    this.writer.Write("<img src=\"");
                    this.userContext.RenderThemeFileUrl(this.writer, button.Image);
                    this.writer.Write("\"");
                    if ((flags & ToolbarButtonFlags.Text) != (ToolbarButtonFlags)0U)
                    {
                        this.writer.Write(" alt=\"\">");
                        this.writer.Write(' ');
                    }
                    else
                    {
                        if (button.TextId != -1018465893)
                        {
                            this.writer.Write(" alt=\"");
                            if (button.ToolTip == null)
                            {
                                this.writer.Write(LocalizedStrings.GetHtmlEncoded(button.TextId));
                            }
                            else
                            {
                                this.writer.Write(button.ToolTip);
                            }
                            this.writer.Write("\"");
                        }
                        this.writer.Write(">");
                    }
                }
                else
                {
                    this.writer.Write("<img class=\"noSrc\" src=\"");
                    this.userContext.RenderThemeFileUrl(this.writer, ThemeFileId.Clear);
                    this.writer.Write("\" alt=\"\">");
                }
                if ((flags & ToolbarButtonFlags.Text) != (ToolbarButtonFlags)0U)
                {
                    this.writer.Write(LocalizedStrings.GetHtmlEncoded(button.TextId));
                }
                this.writer.Write("</div></td>");
                return;
            }
            if (flag)
            {
                this.writer.Write("<td class=\"tabhk\"><img src=\"");
                this.userContext.RenderThemeFileUrl(this.writer, ThemeFileId.Clear1x1);
                this.writer.Write("\"></td>");
            }
            this.writer.Write("<td");
            if ((flags & ToolbarButtonFlags.Sticky) != (ToolbarButtonFlags)0U)
            {
                this.writer.Write(" id=\"{0}\"", button.Command);
                if ((flags & ToolbarButtonFlags.Selected) != (ToolbarButtonFlags)0U)
                {
                    this.writer.Write(" class=\"sl\"");
                }
            }
            if (flag)
            {
                this.writer.Write(" class=\"tab\"");
            }
            this.writer.Write(" nowrap>");
            if (flag)
            {
                this.writer.Write("<div class=\"tabbrd\">");
            }
            string arg = string.Empty;

            if (flag)
            {
                this.writer.Write("<a class=");
                arg = "tab";
            }
            else
            {
                this.writer.Write("<a href=\"#\" onClick=\"return onClkTb('");
                this.writer.Write(button.Command);
                this.writer.Write("');\" class=");
            }
            if ((flags & ToolbarButtonFlags.NoHover) == (ToolbarButtonFlags)0U)
            {
                this.writer.Write("\"btn{0}\"", arg);
            }
            else
            {
                this.writer.Write("\"noHv\"");
            }
            if (button.TextId != -1018465893)
            {
                this.writer.Write(" title=\"");
                if (button.ToolTip == null)
                {
                    this.writer.Write(LocalizedStrings.GetHtmlEncoded(button.TextId));
                }
                else
                {
                    this.writer.Write(button.ToolTip);
                }
                this.writer.Write("\"");
            }
            this.writer.Write(" id=\"");
            if (this.isHeader)
            {
                this.writer.Write("lnkHdr");
            }
            else
            {
                this.writer.Write("lnkFtr");
            }
            this.writer.Write(button.Command);
            this.writer.Write("\">");
            if ((flags & ToolbarButtonFlags.Image) != (ToolbarButtonFlags)0U)
            {
                this.writer.Write("<img src=\"");
                this.userContext.RenderThemeFileUrl(this.writer, button.Image);
                this.writer.Write("\"");
                if ((flags & ToolbarButtonFlags.Text) != (ToolbarButtonFlags)0U)
                {
                    this.writer.Write(" alt=\"\">");
                    this.writer.Write(' ');
                }
                else
                {
                    if (button.TextId != -1018465893)
                    {
                        this.writer.Write(" alt=\"");
                        if (button.ToolTip == null)
                        {
                            this.writer.Write(LocalizedStrings.GetHtmlEncoded(button.TextId));
                        }
                        else
                        {
                            this.writer.Write(button.ToolTip);
                        }
                        this.writer.Write("\"");
                    }
                    this.writer.Write(">");
                }
            }
            else
            {
                this.writer.Write("<img class=\"noSrc\" src=\"");
                this.userContext.RenderThemeFileUrl(this.writer, ThemeFileId.Clear);
                this.writer.Write("\" alt=\"\">");
            }
            if ((flags & ToolbarButtonFlags.Text) != (ToolbarButtonFlags)0U)
            {
                this.writer.Write(LocalizedStrings.GetHtmlEncoded(button.TextId));
            }
            if (flag2)
            {
                this.writer.Write("</div>");
            }
            else
            {
                this.writer.Write("</a>");
            }
            if (flag)
            {
                this.writer.Write("</div>");
            }
            this.writer.Write("</td>");
        }
Exemplo n.º 2
0
 public void RenderButton(ToolbarButton button)
 {
     this.RenderButton(button, ToolbarButtonFlags.None);
 }