Ejemplo n.º 1
0
        static void AddNewSheetTab()
        {
            var tabControl = Document.GetElementById("TabControl");

            _newSheetTab    = new HTMLLIElement();
            _newSheetTab.Id = "new-sheet";

            var anchor = new HTMLAnchorElement();

            anchor.ClassName   = "new-sheet-anchor";
            anchor.TextContent = "+";
            anchor.Href        = "#";

            _newSheetTab.AppendChild(anchor);
            tabControl.AppendChild(_newSheetTab);
        }
Ejemplo n.º 2
0
        public static HTMLDivElement CreateLevelSelectDiv(Action <Level> toSelect)
        {
            HTMLDivElement result = new HTMLDivElement();

            result.Style.Border = "1px solid black";
            HTMLUListElement list = new HTMLUListElement();

            foreach (var level in levels)
            {
                HTMLLIElement levelA = new HTMLLIElement();
                levelA.AppendChild(new HTMLAnchorElement
                {
                    Href      = "javascript:void(0)",
                    OnClick   = e => toSelect(level),
                    InnerHTML = level.Name
                });
                list.AppendChild(levelA);
            }
            result.AppendChild(list);
            return(result);
        }
Ejemplo n.º 3
0
        public static void NewTab(string name = null, Graph G = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = "sheet " + _tabID;
            }

            var canvas = new HTMLCanvasElement();

            canvas.Id        = "Tab" + _tabID;
            canvas.Width     = (int)(Window.InnerWidth);
            canvas.Height    = (int)(Window.InnerHeight);
            canvas.ClassName = "IAmAGraphCanvas";

            canvas.OnShow += delegate
            {
                canvas.Width  = canvas.ParentElement.ClientWidth;
                canvas.Height = canvas.ParentElement.ClientHeight;
            };

            if (G == null)
            {
                G = new Graph();
            }
            var graphCanvas = new GraphCanvas(G);
            var tc          = new TabCanvas(canvas, graphCanvas);

            tc.Invalidate();

            var tabPane = new HTMLDivElement();

            tabPane.ClassName = "tab-pane active";
            tabPane.Id        = "Tab" + _tabID;
            tabPane.AppendChild(canvas);

            var tabControlContent = Document.GetElementById("TabControlContent");

            foreach (var child in tabControlContent.Children)
            {
                child.ClassName = "tab-pane";
            }
            tabControlContent.AppendChild(tabPane);

            var tab = new HTMLLIElement();

            tab.ClassName = "active";

            var anchor = new HTMLAnchorElement();

            anchor.SetAttribute("data-toggle", "tab");
            anchor.TextContent         = name;
            anchor.Href                = "#Tab" + _tabID;
            _canvasLookup[anchor.Href] = tc;
            _currentTabCanvas          = anchor.Href;

            tab.AppendChild(anchor);

            var tabControl = Document.GetElementById("TabControl");

            foreach (var child in tabControl.Children)
            {
                child.ClassName = "narf";
            }
            tabControl.InsertBefore(tab, _newSheetTab);

            _tabID++;
        }