public static void AppendItemList(Control control, params Union <string, Control, HTMLElement>[] typos)
        {
            if (typos == null || typos.Length == 0)
            {
                return;
            }

            var length = typos.Length;
            var list   = new Union <string, Control, HTMLElement> [length];

            for (int i = 0; i < length; i++)
            {
                if (typos[i] == null)
                {
                    list[i] = new ListItem();
                    continue;
                }

                if (typos[i].Is <ListItem>())
                {
                    list[i] = typos[i];
                }
                else
                {
                    list[i] = new ListItem(typos[i]);
                }
            }
            BootWidget.AppendTypos(control, list);
        }
Ejemplo n.º 2
0
        public ParagraphList(params Union <string, Control, HTMLElement>[] typos) : base(new HTMLDivElement())
        {
            if (typos == null || typos.Length == 0)
            {
                return;
            }

            var length = typos.Length;
            var list   = new Union <string, Control, HTMLElement> [length];

            for (int i = 0; i < length; i++)
            {
                if (typos[i] == null)
                {
                    list[i] = new Paragraph();
                    continue;
                }

                if (typos[i].Is <Paragraph>())
                {
                    list[i] = typos[i];
                }
                else
                {
                    list[i] = new Paragraph(typos[i]);
                }
            }
            BootWidget.AppendTypos(this, list);
        }
        private void makeChangesForNav(Navbar bar)
        {
            if (bar == null)
            {
                return;
            }
            switch (bar.NavbarLocation)
            {
            //case NavBarLocation.Fixed_Top:
            //	this.BodyStyle.PaddingTop = "70px";
            //	break;
            //case NavBarLocation.Fixed_Bottom:
            //	this.BodyStyle.PaddingBottom = "70px";
            //	break;
            case NavBarLocation.Static_Top:
                activeNavar    = bar;
                bar.Style.Top  = "0";
                bar.Style.Left = "0";

                var div = new BootWidget();
                div.Style.Position  = Position.Absolute;
                div.Style.OverflowY = Overflow.Auto;
                div.Size            = new Vector2("100%", "calc(100% - 50px)");
                div.Location        = new Vector2(0, 50);

                this.prevBody.InsertBefore(div, this.Body);

                div.Content.AppendChild(this.Body);

                this.prevBody.InsertBefore(bar, div);

                return;
            }
            this.prevBody.InsertBefore(bar, this.Body);
        }
        public BootWindow(params Union <string, Control, HTMLElement>[] typos) : base("")
        {
            if (assignedBootWindow == string.Empty)
            {
                assignedBootWindow = CreateWindowHandle().ToString();
            }

            responsiveClass = GetResponsiveClass();

            privateSyle = new HTMLStyleElement();
            this.Body.AppendChild(privateSyle);

            var container = (new BootStyleWidget("container"));                      // fluid

            this.BackColor = Color.White;
            this.Body.AppendChild(container.Content);
            this.BodyStyle.OverflowY = Overflow.Auto;
            this.BodyStyle.OverflowX = Overflow.Hidden;

            prevBody = this.Body;

            this.Body = (HTMLDivElement)container.Content;
            this.BodyStyle.Padding = "0";

            SetCalcSize();

            if (typos != null)
            {
                int length = typos.Length;
                for (int i = 0; i < length; i++)
                {
                    if (typos[i].Is <string>())
                    {
                        this.Body.AppendChild(Document.CreateTextNode((string)typos[i]));
                    }
                    else if (typos[i].Is <Control>())
                    {
                        if (typos[i].Is <Navbar>())
                        {
                            makeChangesForNav((Navbar)typos[i]);
                        }
                        else
                        {
                            this.Body.AppendChild((Control)typos[i]);
                        }
                    }
                    else if (typos[i].Is <HTMLElement>())
                    {
                        if (((HTMLElement)typos[i]).TagName.ToUpper() == "NAV")
                        {
                            makeChangesForNav(BootWidget.CastElement <Navbar>((HTMLElement)typos[i]));
                        }
                        else
                        {
                            this.Body.AppendChild((HTMLElement)typos[i]);
                        }
                    }
                }
            }
        }
        public static void AppendDataRow(Control control, params Union <string, Control, HTMLElement>[] typos)
        {
            if (typos == null || typos.Length == 0)
            {
                return;
            }

            var length = typos.Length;
            var list   = new Union <string, Control, HTMLElement> [length];

            for (int i = 0; i < length; i++)
            {
                if (typos[i] == null)
                {
                    list[i] = new TableCell();
                    continue;
                }

                if (typos[i].Is <TableCell>())
                {
                    list[i] = typos[i];
                }
                else if (typos[i].Is <TableHeader>())
                {
                    var x = ((TableHeader)typos[i]);
                    list[i] = x;
                    x.Content.SetAttribute("scope", "row");
                }
                else
                {
                    list[i] = new TableCell(typos[i]);
                }
            }
            BootWidget.AppendTypos(control, list);
        }
Ejemplo n.º 6
0
        public static BootWidget ApplyColumns(this BootWidget widget, params Rule[] colClasses)
        {
            int length;

            if (widget != null && colClasses != null && (length = colClasses.Length) > 0)
            {
                var builder = new StringBuilder();

                for (int i = 0; i < length; i++)
                {
                    widget.ClassList.Add(colClasses[i].value);
                }
            }
            return(widget);
        }
Ejemplo n.º 7
0
        public static BootWindow GetWidgetWindow(Node element)
        {
            if (element == null)
            {
                return(null);
            }

            var x = BootWidget.CastElement <BootWidget>(element.As <HTMLElement>());

            if (x == null)
            {
                return(null);
            }

            var bootHandle = x.BootWindowHandle;

            for (int i = 0; i < Form.FormCollections.Count; i++)
            {
                if (Form.FormCollections[i].FormOwner is BootWindow)
                {
                    if (Global.ParseInt(Form.FormCollections[i].FormOwner.As <BootWindow>().GetBootHandle()) == bootHandle)
                    {
                        return(Form.FormCollections[i].FormOwner.As <BootWindow>());
                    }
                }
                for (int j = 0; j < Form.FormCollections[i].VisibleForms.Count; j++)
                {
                    if (Form.FormCollections[i].VisibleForms[j] is BootWindow)
                    {
                        if (Global.ParseInt(Form.FormCollections[i].VisibleForms[j].As <BootWindow>().GetBootHandle()) == bootHandle)
                        {
                            return(Form.FormCollections[i].VisibleForms[j].As <BootWindow>());
                        }
                    }
                }
            }

            return(null);
        }