예제 #1
0
        public WindowContext(IRootElement nodeBase) : base($"Window_{nodeBase.NodeBase.Id}_")
        {
            WindowingService = nodeBase.ServiceData.OperationManager.GetOperation <WindowingService>();
            StyleOperator    = nodeBase.ServiceData.OperationManager.GetOperation <StyleOperator>();

            Add("node", ElementNode = new LinkMember(this));

            InitTitlebar(nodeBase);
            InitTabSection(nodeBase);
            InitContentPane(nodeBase);

            cssClass = "window-context";

            WithAttribute("style", out StyleContext styleContext);
            styleContext.WithStyle(StyleOperator, this,
                                   ("position", "absolute"),
                                   ("left", $"{Transform.Position.X}px"),
                                   ("top", $"{Transform.Position.Y}px"),
                                   ("width", $"{Transform.Size.Width}px"),
                                   ("height", $"{Transform.Size.Height}px"),
                                   ("border", "2px solid black"));

            Transform.OnMove = (transform, position) =>
            {
                styleContext.WithStyle(StyleOperator, this,
                                       ("left", $"{Transform.Position.X}px"),
                                       ("top", $"{Transform.Position.Y}px"));
            };

            Transform.OnResize = (transform, size) =>
            {
                styleContext.WithStyle(StyleOperator, this,
                                       ("width", $"{Transform.Size.Width}px"),
                                       ("height", $"{Transform.Size.Height}px"));
            };

            PreventDefaults.Add("onfocus");
            PreventDefaults.Add("ondragover");
            PreventDefaults.Add("ondrop");
            StopPropagations.Add("ondragover");
            StopPropagations.Add("ondrop");

            AddEvent("onmousedown", OnMouseDown);
            AddEvent("onmouseup", WindowingService.WindowResizeUp);
            AddEvent("onmousemove", OnMouseMove);
            AddEvent("onmouseleave", OnMouseLeave);
            AddEvent("ondrop", OnTabWindowDropped);
            AddEvent("ondragover", a => {});
        }
        public ContentPaneContext(IRootElement nodeBase) : base($"Content_{nodeBase.NodeBase.Id}_")
        {
            StyleOperator           = nodeBase.ServiceData.OperationManager.GetOperation <StyleOperator>();
            Add("node", ElementNode = new LinkMember(this));

            WithAttribute("style", out StyleContext contentStyle);
            contentStyle.WithStyle(StyleOperator, this,
                                   ("background-color", "lightblue"),
                                   ("top", "0px"),
                                   ("left", "0px"),
                                   ("place-self", "stretch"),
                                   ("position", "relative"));

            SetHtml("what");
        }
        public void FiguresLinkmap_Test()
        {
            IFigures figuresA = new Figures(typeof(FieldsAndPropertiesModel), "Figures_A_Test").Combine();

            IFigures figuresB = new Figures(typeof(FieldsAndPropertiesModel), "Figures_B_Test").Combine();

            FiguresLinkmap_AddFigures_A_Helper_Test(figuresA);

            FiguresLinkmap_AddFigures_B_Helper_Test(figuresB);

            Link fl = new Link(figuresA, figuresB, figuresA.Rubrics.KeyRubrics);

            NodeCatalog nc     = Linker.Map;
            LinkMember  olm    = fl.Origin;
            var         ocards = figuresA.AsCards().ToArray();

            for (int i = 0; i < ocards.Length; i++)
            {
                var ocard = ocards[i];
                // var bcard = new BranchCard(ocard, olm);
                //ulong linkKey = bcard.UniquesAsKey();
                ulong      linkKey = olm.FigureLinkKey(ocard.Value);
                BranchDeck branch;
                if (!nc.TryGet(linkKey, out branch))
                {
                    branch = new BranchDeck(olm, linkKey);
                }
                branch.Put(ocard);
                nc.Add(branch);
            }
            LinkMember tlm    = fl.Target;
            var        tcards = figuresB.AsCards().ToArray();

            for (int i = 0; i < tcards.Length; i++)
            {
                var tcard = tcards[i];
                // var bcard = new BranchCard(tcard, tlm);
                // ulong linkKey = bcard.UniquesAsKey();
                ulong      linkKey = tlm.FigureLinkKey(tcard.Value);
                BranchDeck branch;
                if (!nc.TryGet(linkKey, out branch))
                {
                    branch = new BranchDeck(tlm, linkKey);
                }
                branch.Put(tcard);
                nc.Add(branch);
            }
        }
예제 #4
0
        public TitlebarContext(IRootElement nodeBase) : base($"Title_{nodeBase.NodeBase.Id}_")
        {
            StyleOperator           = nodeBase.ServiceData.OperationManager.GetOperation <StyleOperator>();
            Add("node", ElementNode = new LinkMember(this));

            WithAttribute("style", out StyleContext sliderStyle);
            sliderStyle.WithStyle(StyleOperator, this,
                                  ("background-color", "black"),
                                  ("top", "0px"),
                                  ("left", "0px"),
                                  ("place-self", "stretch"),
                                  ("position", "relative"));

            AddEvent("onmousedown", OnMouseDown);
            AddEvent("onmouseup", OnMouseUp);

            SetHtml("what");
        }
예제 #5
0
        public TabSectionContext(IRootElement nodeBase) : base($"Tabs_{nodeBase.NodeBase.Id}_")
        {
            StyleOperator           = nodeBase.ServiceData.OperationManager.GetOperation <StyleOperator>();
            Add("node", ElementNode = new LinkMember(this));

            WithAttribute("style", out StyleContext tabsStyle);
            tabsStyle.WithStyle(StyleOperator, this,
                                ("position", "relative"),
                                ("background-color", "orange"),
                                ("place-self", "stretch"),
                                ("display", "grid"),
                                ("grid-auto-columns", "min-content"),
                                ("grid-template-areas", "\"\""),
                                ("overflow", "hidden"),
                                ("grid-auto-flow", "column"),
                                ("user-select", "none"));

            WithAttribute("draggable", out AttributeString drag);
            drag.Value = "false";
        }
예제 #6
0
        public ContainerContext(IRootElement nodeBase) : base($"Container_{nodeBase.NodeBase.Id}_")
        {
            cssClass = "window-container";

            NodeBase = nodeBase;
            Add("node", ElementNode = new LinkMember(this));

            WithAttribute("draggable", out AttributeString drag);
            drag.Value = "false";

            WindowingService = nodeBase.ServiceData.OperationManager.GetOperation <WindowingService>();
            WindowingService.ContainerContext = this;
            StyleOperator = nodeBase.ServiceData.OperationManager.GetOperation <StyleOperator>();

            WithAttribute("style", out StyleContext styleContext);
            styleContext.WithStyle(StyleOperator, this,
                                   ("background-color", "red"),
                                   ("position", "relative"),
                                   ("touch-action", "none"));

            Slider = new ElementContext("Slider");
            Slider.WithAttribute("style", out StyleContext sliderStyle);
            sliderStyle.WithStyle(StyleOperator, Slider,
                                  ("top", "0px"),
                                  ("left", "0px"),
                                  ("position", "absolute"));

            SlideMember = new LinkMember(Slider);
            ElementNode.Add(SlideMember);

            SliderTransform        = new Transform();
            SliderTransform.OnMove = (transform1, position) =>
            {
                sliderStyle.WithStyle(StyleOperator, Slider,
                                      ("margin-top", $"{position.Y}px"));
            };

            string[] events =
            {
            };

            StopPropagations.AddRange(events);
            StopPropagations.Add("onwheel");

            PreventDefaults.Add("ondragover");
            PreventDefaults.Add("ondrop");

            AddEvent("onmousedown", WindowingService.ContainerMouseDown);
            AddEvent("onmousemove", WindowingService.ContainerMouseMove);
            AddEvent("onmouseup", WindowingService.ContainerMouseUp);
            AddEvent("onmouseleave", WindowingService.ContainerMouseLeave);
            AddEvent("ondragend", WindowingService.ContainerMouseUp);
            AddEvent("onwheel", WindowingService.ContainerWheel);
            AddEvent("ondrop", WindowingService.OnContainerTabDropped);
            AddEvent("ondragover", a => {  });

            var hold = WindowingService.CreateWindow;

            for (int i = 0; i < 4; i++)
            {
                var tab = WindowingService.CreateTab();
                tab.TabContext = new TabContext(nodeBase, tab)
                {
                };
                tab.TabContext.SetHtml($"TAB {i}");
                WindowingService.AddTabToWindow(hold, tab);
            }
        }
 public BranchCard(ICard <ICard <IFigure> > value, LinkMember member) : base(value)
 {
     Member = member;
 }
 public BranchCard(ulong key, ICard <IFigure> value, LinkMember member) : base(key, value)
 {
     Member = member;
 }
 public BranchCard(LinkMember member)
 {
     Member = member;
 }