Exemplo n.º 1
0
        protected override JsonApplication JsonApplicationCreate()
        {
            JsonApplication result = new JsonApplication();

            result.Session = Guid.NewGuid();
            //
            new GridKeyboard(result, "GridKeyboard");
            var container   = new LayoutContainer(result, "Container");
            var rowHeader   = new LayoutRow(container, "Header");
            var cellHeader1 = new LayoutCell(rowHeader, "HeaderCell1");

            new GridField(cellHeader1, "Field", null, null, null);
            var rowContent   = new LayoutRow(container, "Content");
            var cellContent1 = new LayoutCell(rowContent, "ContentCell1");

            new Grid(cellContent1, "Master", "Master");
            var cellContent2 = new LayoutCell(rowContent, "ContentCell2");

            new Grid(cellContent2, "Detail", "Detail");
            var rowFooter  = new LayoutRow(container, "Footer");
            var cellFooter = new LayoutCell(rowFooter, "FooterCell1");
            var button     = new Button(cellFooter, "Hello");
            //
            var gridData = new GridData();

            gridData.LoadToJsonGrid("Master", typeof(Database.dbo.TableName));
            gridData.ColumnList["Master"].Where(item => item.FieldName == "TableName2").First().IsUpdate = true;
            gridData.LoadToJsonGrid("Detail", typeof(Database.dbo.AirportDisplay));
            result.GridData = gridData;
            //
            return(result);
        }
Exemplo n.º 2
0
            public PanelTab()
            {
                MinSize    = new Vector2(TabMinWidth, TabHeight);
                MaxSize    = new Vector2(TabMaxWidth, TabHeight);
                LayoutCell = new LayoutCell(Alignment.LeftTop);
                Size       = MinSize;
                Layout     = new HBoxLayout();
                var caption = new SimpleText {
                    Id             = "TextPresenter",
                    Padding        = Theme.Metrics.ControlsPadding,
                    ForceUncutText = false,
                    FontHeight     = Theme.Metrics.TextHeight,
                    HAlignment     = HAlignment.Center,
                    VAlignment     = VAlignment.Center,
                    OverflowMode   = TextOverflowMode.Ellipsis,
                    LayoutCell     = new LayoutCell(Alignment.Center),
                };
                var presenter = new TabPresenter(caption);

                CompoundPresenter.Add(presenter);
                DefaultAnimation.AnimationEngine = new AnimationEngineDelegate {
                    OnRunAnimation = (animation, markerId, animationTimeCorrection) => {
                        presenter.SetState(markerId);
                        return(true);
                    }
                };
                AddNode(caption);
                HitTestTarget = true;
                LateTasks.Add(Theme.MouseHoverInvalidationTask(this));
                this.AddChangeWatcher(() => Active,
                                      isActive => Padding = isActive ? new Thickness {
                    Top = -1f, Bottom = 1f
                } : new Thickness());
            }
Exemplo n.º 3
0
 public static LayoutCellEntity ToEntity(this LayoutCell contract)
 {
     return(new LayoutCellEntity
     {
         CellType = contract.CellType,
         ClassName = contract.ClassName,
         Options = JsonConvert.SerializeObject(contract.Options),
     });
 }
Exemplo n.º 4
0
        public PathBar(Func <string, bool> openPath, FilesystemModel filesystemModel)
        {
            this.filesystemModel = filesystemModel;
            this.openPath        = openPath;
            Layout     = new HBoxLayout();
            LayoutCell = new LayoutCell(Alignment.LeftCenter);
            Padding    = new Thickness(1);

            this.AddChangeWatcher(() => filesystemModel.CurrentPath, (p) => {
                UpdatePathBar();
            });
        }
Exemplo n.º 5
0
 public LinkIndicatorButton(ITexture texture, bool clickable = false)
 {
     Highlightable = false;
     MinMaxSize    = defaultMinMaxSize;
     Padding       = defaultPadding;
     LayoutCell    = new LayoutCell(Alignment.RightCenter);
     Texture       = texture;
     if (clickable)
     {
         Clicked += () => LinkIndicationContextMenu.Create(LinkedNodes);
     }
 }
Exemplo n.º 6
0
        public ThemedDeleteButton()
        {
            var presenter = new VectorShapeButtonPresenter(new VectorShape {
                new VectorShape.Line(0.3f, 0.5f, 0.7f, 0.5f, Color4.White, 0.075f * 1.5f),
            });

            LayoutCell    = new LayoutCell(Alignment.Center, stretchX: 0);
            PostPresenter = presenter;
            MinMaxSize    = Theme.Metrics.CloseButtonSize;
            DefaultAnimation.AnimationEngine = new AnimationEngineDelegate {
                OnRunAnimation = (animation, markerId, animationTimeCorrection) => {
                    presenter.SetState(markerId);
                    return(true);
                }
            };
        }
Exemplo n.º 7
0
        public RulersWidget()
        {
            LayoutCell  = new LayoutCell();
            Anchors     = Anchors.LeftRightTopBottom;
            topRulerBar = new Widget {
                Anchors       = Anchors.LeftRight,
                Id            = "TopRuler",
                HitTestTarget = true,
                MinMaxHeight  = RulerHeight,
                Height        = RulerHeight,
            };

            leftRulerBar = new Widget {
                Anchors       = Anchors.Left | Anchors.Bottom | Anchors.Top,
                HitTestTarget = true,
                Id            = "LeftRuler",
                MinMaxWidth   = RulerHeight,
                Width         = RulerHeight,
            };

            topRulerBar.Tasks.Add(CreateLineTask(topRulerBar, RulerOrientation.Horizontal));
            leftRulerBar.Tasks.Add(CreateLineTask(leftRulerBar, RulerOrientation.Vertical));

            Nodes.Add(leftRulerBar);
            Nodes.Add(topRulerBar);
            topRulerBar.CompoundPostPresenter.Push(new RulerBarPresenter(RulerOrientation.Horizontal));
            leftRulerBar.CompoundPostPresenter.Push(new RulerBarPresenter(RulerOrientation.Vertical));
            CompoundPostPresenter.Push(new RulerLinesPresenter(leftRulerBar, topRulerBar));
            this.AddChangeWatcher(LocalMousePosition, _ => {
                if (SceneView.Instance.Panel.IsMouseOverThisOrDescendant())
                {
                    Window.Current.Invalidate();
                }
            });
            this.AddChangeWatcher(() => ProjectUserPreferences.Instance.RulerVisible,
                                  v => {
                topRulerBar.Visible  = v;
                leftRulerBar.Visible = v;
            });
        }
Exemplo n.º 8
0
        public ZoomWidget()
        {
            MinMaxHeight = FrameHeight;
            LayoutCell   = new LayoutCell(new Alignment {
                X = HAlignment.Center, Y = VAlignment.Bottom
            }, 1, 0);
            Layout = new HBoxLayout {
                Spacing = 8
            };
            Padding       = new Thickness(10, 0);
            Anchors       = Anchors.LeftRight | Anchors.Bottom;
            HitTestTarget = true;

            slider = new ThemedSlider {
                MinMaxSize = new Vector2(100, 2),
                Size       = new Vector2(100, 2),
                Y          = FrameHeight / 2,
                LayoutCell = new LayoutCell(Alignment.RightCenter, 1),
                Anchors    = Anchors.Right,
                RangeMin   = 0,
                RangeMax   = zoomTable.Count - 1,
                Step       = 1
            };
            slider.CompoundPresenter.Add(new SliderCenterPresenter(FindNearest(1f, 0, zoomTable.Count), zoomTable.Count));

            var zoomInButton = new ToolbarButton {
                MinMaxSize = new Vector2(FrameHeight),
                Size       = new Vector2(FrameHeight),
                LayoutCell = new LayoutCell(Alignment.RightCenter),
                Anchors    = Anchors.Right,
                Clicked    = () => {
                    if (CurrentSliderValue <= SceneView.Scene.Scale.X)
                    {
                        slider.Value = (slider.Value + slider.Step).Clamp(slider.RangeMin, slider.RangeMax);
                    }
                    Zoom(CurrentSliderValue);
                },
                Texture = IconPool.GetTexture("SceneView.ZoomIn"),
            };
            var zoomOutButton = new ToolbarButton {
                MinMaxSize = new Vector2(FrameHeight),
                Size       = new Vector2(FrameHeight),
                LayoutCell = new LayoutCell(Alignment.RightCenter),
                Anchors    = Anchors.Right,
                Clicked    = () => {
                    if (CurrentSliderValue >= SceneView.Scene.Scale.X)
                    {
                        slider.Value = (slider.Value - slider.Step).Clamp(slider.RangeMin, slider.RangeMax);
                    }
                    Zoom(CurrentSliderValue);
                },
                Texture = IconPool.GetTexture("SceneView.ZoomOut"),
            };

            var zoomEditor = new ThemedEditBox {
                LayoutCell  = new LayoutCell(Alignment.RightCenter),
                Anchors     = Anchors.Right,
                MinMaxWidth = 50
            };

            zoomEditor.Submitted += value => {
                var success = float.TryParse(value.TrimEnd('%'), out var zoom) && zoomTable.Count > 0;
                if (success)
                {
                    Zoom(Mathf.Clamp(zoom / 100, zoomTable[0], zoomTable[zoomTable.Count - 1]));
                }
            };

            this.AddChangeWatcher(() => SceneView.Scene.Scale.X, value => {
                var index       = FindNearest(value, 0, zoomTable.Count);
                slider.Value    = index;
                zoomEditor.Text = $"{value * 100f}%";
            });
            slider.Changed += () => Zoom(CurrentSliderValue);
            AddNode(new Widget {
                LayoutCell = new LayoutCell(Alignment.LeftCenter, 1)
            });
            AddNode(zoomEditor);
            AddNode(zoomOutButton);
            AddNode(slider);
            AddNode(zoomInButton);
        }