예제 #1
0
파일: ProgressBar.cs 프로젝트: dstiert/Myra
        protected ProgressBar(ProgressBarStyle style) : base(style)
        {
            _filledImage = new Image
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch
            };
            if (Orientation == Orientation.Horizontal)
            {
                ColumnsProportions.Add(new Proportion(ProportionType.Part, 0));
                ColumnsProportions.Add(new Proportion(ProportionType.Fill));
                TotalColumnsPart = 1.0f;
            }
            else
            {
                RowsProportions.Add(new Proportion(ProportionType.Fill));
                RowsProportions.Add(new Proportion(ProportionType.Part, 0));
                TotalRowsPart = 1.0f;

                _filledImage.GridPositionY = 1;
            }

            Widgets.Add(_filledImage);

            if (style != null)
            {
                ApplyProgressBarStyle(style);
            }

            Maximum = 100;
        }
예제 #2
0
        public TreeNode(TreeStyle style, Tree topTree)
        {
            _topTree = topTree;

            ColumnSpacing = 2;
            RowSpacing    = 2;

            if (_topTree != null)
            {
                _topTree.AllNodes.Add(this);
            }

            _mark = new ImageButton((ImageButtonStyle)null)
            {
                Toggleable          = true,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center
            };

            _mark.Down += MarkOnDown;
            _mark.Up   += MarkOnUp;

            Widgets.Add(_mark);

            _label = new TextBlock
            {
                GridPositionX = 1,
                Wrap          = false
            };

            Widgets.Add(_label);

            HorizontalAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment   = VerticalAlignment.Stretch;

            ColumnsProportions.Add(new Proportion(ProportionType.Auto));
            ColumnsProportions.Add(new Proportion(ProportionType.Fill));

            RowsProportions.Add(new Proportion(ProportionType.Auto));
            RowsProportions.Add(new Proportion(ProportionType.Auto));

            // Second is yet another grid holding child nodes
            _childNodesGrid = new Grid
            {
                Visible       = false,
                GridPositionX = 1,
                GridPositionY = 1
            };

            Widgets.Add(_childNodesGrid);

            if (style != null)
            {
                ApplyTreeNodeStyle(style);
            }

            UpdateMark();
            UpdateHasRoot();
        }
예제 #3
0
            public SubGrid(PropertyGrid parent, object value, string header, string category, Record parentProperty)
            {
                ColumnSpacing = 4;
                RowSpacing    = 4;

                ColumnsProportions.Add(new Proportion(ProportionType.Auto));
                ColumnsProportions.Add(new Proportion(ProportionType.Fill));
                RowsProportions.Add(new Proportion(ProportionType.Auto));
                RowsProportions.Add(new Proportion(ProportionType.Auto));

                _propertyGrid = new PropertyGrid(parent.PropertyGridStyle, category, parentProperty)
                {
                    Object              = value,
                    Visible             = false,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    GridPositionX       = 1,
                    GridPositionY       = 1,
                    ColorChangeHandler  = parent.ColorChangeHandler,
                    _parentGrid         = parent
                };

                // Mark
                _mark = new ImageButton(parent.PropertyGridStyle.MarkStyle)
                {
                    Toggleable          = true,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Center
                };

                Widgets.Add(_mark);

                _mark.Down += (sender, args) =>
                {
                    _propertyGrid.Visible = true;
                    parent._expandedCategories.Add(category);
                };

                _mark.Up += (sender, args) =>
                {
                    _propertyGrid.Visible = false;
                    parent._expandedCategories.Remove(category);
                };

                var label = new TextBlock(parent.PropertyGridStyle.LabelStyle)
                {
                    Text          = header,
                    GridPositionX = 1
                };

                Widgets.Add(label);
                Widgets.Add(_propertyGrid);
            }
예제 #4
0
        public SpinButton(SpinButtonStyle style) : base(style)
        {
            HorizontalAlignment = HorizontalAlignment.Left;
            VerticalAlignment   = VerticalAlignment.Top;

            ColumnsProportions.Add(new Proportion(ProportionType.Fill));
            ColumnsProportions.Add(new Proportion());

            RowsProportions.Add(new Proportion());
            RowsProportions.Add(new Proportion());

            _textField = new TextField
            {
                GridSpanY           = 2,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                InputFilter         = InputFilter
            };

            _textField.TextChanged       += TextFieldOnTextChanged;
            _textField.TextChangedByUser += TextFieldOnTextChangedByUser;

            Widgets.Add(_textField);

            _upButton = new ImageButton
            {
                GridPositionX              = 1,
                ContentVerticalAlignment   = VerticalAlignment.Center,
                ContentHorizontalAlignment = HorizontalAlignment.Center
            };
            _upButton.Up += UpButtonOnUp;

            Widgets.Add(_upButton);

            _downButton = new ImageButton
            {
                GridPositionX              = 1,
                GridPositionY              = 1,
                ContentVerticalAlignment   = VerticalAlignment.Center,
                ContentHorizontalAlignment = HorizontalAlignment.Center
            };
            _downButton.Up += DownButtonOnUp;
            Widgets.Add(_downButton);

            if (style != null)
            {
                ApplySpinButtonStyle(style);
            }

            Value = 0;
        }
예제 #5
0
        private PropertyGrid(TreeStyle style, string category, Record parentProperty) : base(null)
        {
            _parentProperty = parentProperty;
            ColumnSpacing   = 8;
            RowSpacing      = 8;
            ColumnsProportions.Add(new Proportion(ProportionType.Pixels, 150));
            ColumnsProportions.Add(new Proportion(ProportionType.Fill));

            Category = category;

            if (style != null)
            {
                ApplyPropertyGridStyle(style);
            }
        }
예제 #6
0
파일: Menu.cs 프로젝트: damianimmortal/Myra
        private void AddItem(Widget menuItem, int index)
        {
            if (Orientation == Orientation.Horizontal)
            {
                ColumnsProportions.Add(new Proportion(ProportionType.Auto));
            }
            else
            {
                menuItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                menuItem.VerticalAlignment   = VerticalAlignment.Stretch;
                RowsProportions.Add(new Proportion(ProportionType.Auto));
            }

            Widgets.Insert(index, menuItem);

            UpdateGridPositions();
        }
예제 #7
0
파일: Menu.cs 프로젝트: damianimmortal/Myra
        private void RemoveItem(IMenuItem iMenuItem)
        {
            var menuItem = iMenuItem as MenuItem;

            if (menuItem != null)
            {
                menuItem.Changed -= MenuItemOnChanged;
            }

            var widget = iMenuItem.Widget;

            if (widget == null)
            {
                return;
            }

            var asMenuItemButton = widget as MenuItemButton;

            if (asMenuItemButton != null)
            {
                asMenuItemButton.Down         -= ButtonOnDown;
                asMenuItemButton.Up           -= ButtonOnUp;
                asMenuItemButton.MouseEntered -= MouseOnEntered;
                asMenuItemButton.MouseLeft    -= MouseOnLeft;
            }

            var index = Widgets.IndexOf(widget);

            if (Orientation == Orientation.Horizontal)
            {
                ColumnsProportions.RemoveAt(index);
            }
            else
            {
                RowsProportions.RemoveAt(index);
            }

            Widgets.RemoveAt(index);
            UpdateGridPositions();
        }
예제 #8
0
        private void BuildUI()
        {
            gridcontent_label                     = new Label();
            gridcontent_label.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            gridcontent_label.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            gridcontent_label.Padding             = new Thickness(5, 0);
            gridcontent_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            gridcontent_label.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            gridcontent_label.Visible             = false;
            gridcontent_label.Id                  = "gridcontent_label";

            gridfirstcolumn_label                     = new Label();
            gridfirstcolumn_label.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            gridfirstcolumn_label.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            gridfirstcolumn_label.TextColor           = Color.Black;
            gridfirstcolumn_label.Padding             = new Thickness(5, 0);
            gridfirstcolumn_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            gridfirstcolumn_label.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            gridfirstcolumn_label.Visible             = false;
            gridfirstcolumn_label.Background          = new SolidBrush("#FFFFFFFF");
            gridfirstcolumn_label.Id                  = "gridfirstcolumn_label";

            gridfirstrowmovablecolumns_label                     = new Label();
            gridfirstrowmovablecolumns_label.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            gridfirstrowmovablecolumns_label.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            gridfirstrowmovablecolumns_label.TextColor           = Color.Black;
            gridfirstrowmovablecolumns_label.BorderThickness     = new Thickness(0, 0, 0, 1);
            gridfirstrowmovablecolumns_label.Padding             = new Thickness(5, 0);
            gridfirstrowmovablecolumns_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            gridfirstrowmovablecolumns_label.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            gridfirstrowmovablecolumns_label.Visible             = false;
            gridfirstrowmovablecolumns_label.Background          = new SolidBrush("#FFFFFFFF");
            gridfirstrowmovablecolumns_label.Border              = new SolidBrush("#000000FF");
            gridfirstrowmovablecolumns_label.Id                  = "gridfirstrowmovablecolumns_label";

            graycell_label = new Label();
            graycell_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            graycell_label.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            graycell_label.Visible             = false;
            graycell_label.Background          = new SolidBrush("#404040FF");
            graycell_label.Id = "graycell_label";

            var label1 = new Label();

            label1.Text                = "Joueurs";
            label1.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label1.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label1.TextColor           = Color.Black;
            label1.BorderThickness     = new Thickness(0, 0, 0, 1);
            label1.Padding             = new Thickness(5, 0);
            label1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label1.Border              = new SolidBrush("#000000FF");

            var label2 = new Label();

            label2.Text                = "Couleur";
            label2.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label2.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label2.TextColor           = Color.Black;
            label2.BorderThickness     = new Thickness(0, 0, 0, 1);
            label2.Padding             = new Thickness(5, 0);
            label2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label2.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label2.GridColumn          = 1;
            label2.Border              = new SolidBrush("#000000FF");

            var label3 = new Label();

            label3.Text                = "↑ ou ↓";
            label3.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label3.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label3.TextColor           = Color.Black;
            label3.BorderThickness     = new Thickness(0, 0, 0, 1);
            label3.Padding             = new Thickness(5, 0);
            label3.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label3.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label3.GridColumn          = 2;
            label3.Border              = new SolidBrush("#000000FF");

            var label4 = new Label();

            label4.Text                = "↔ ou ↕";
            label4.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label4.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label4.TextColor           = Color.Black;
            label4.BorderThickness     = new Thickness(0, 0, 0, 1);
            label4.Padding             = new Thickness(5, 0);
            label4.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label4.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label4.GridColumn          = 3;
            label4.Border              = new SolidBrush("#000000FF");

            var label5 = new Label();

            label5.Text                = "Suite";
            label5.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label5.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label5.TextColor           = Color.Black;
            label5.BorderThickness     = new Thickness(0, 0, 0, 1);
            label5.Padding             = new Thickness(5, 0);
            label5.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label5.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label5.GridColumn          = 4;
            label5.Border              = new SolidBrush("#000000FF");

            movecolumnleft_button                     = new TextButton();
            movecolumnleft_button.Text                = "◄";
            movecolumnleft_button.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            movecolumnleft_button.BorderThickness     = new Thickness(0, 0, 0, 1);
            movecolumnleft_button.Padding             = new Thickness(3, 0);
            movecolumnleft_button.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            movecolumnleft_button.GridColumn          = 5;
            movecolumnleft_button.Border              = new SolidBrush("#404040FF");
            movecolumnleft_button.Id                  = "movecolumnleft_button";

            movecolumnright_button                     = new TextButton();
            movecolumnright_button.Text                = "►";
            movecolumnright_button.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            movecolumnright_button.BorderThickness     = new Thickness(0, 0, 0, 1);
            movecolumnright_button.Padding             = new Thickness(3, 0);
            movecolumnright_button.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            movecolumnright_button.GridColumn          = 6;
            movecolumnright_button.Border              = new SolidBrush("#404040FF");
            movecolumnright_button.Id                  = "movecolumnright_button";

            var label6 = new Label();

            label6.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label6.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label6.TextColor           = Color.Black;
            label6.BorderThickness     = new Thickness(0, 0, 0, 1);
            label6.Padding             = new Thickness(5, 0);
            label6.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label6.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label6.GridColumn          = 7;
            label6.Border              = new SolidBrush("#000000FF");

            var label7 = new Label();

            label7.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label7.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label7.TextColor           = Color.Black;
            label7.BorderThickness     = new Thickness(0, 0, 0, 1);
            label7.Padding             = new Thickness(5, 0);
            label7.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label7.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label7.GridColumn          = 8;
            label7.Border              = new SolidBrush("#000000FF");

            var label8 = new Label();

            label8.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label8.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label8.TextColor           = Color.Black;
            label8.BorderThickness     = new Thickness(0, 0, 0, 1);
            label8.Padding             = new Thickness(5, 0);
            label8.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label8.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label8.GridColumn          = 9;
            label8.Border              = new SolidBrush("#000000FF");

            var label9 = new Label();

            label9.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label9.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label9.TextColor           = Color.Black;
            label9.BorderThickness     = new Thickness(0, 0, 0, 1);
            label9.Padding             = new Thickness(5, 0);
            label9.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label9.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label9.GridColumn          = 10;
            label9.Border              = new SolidBrush("#000000FF");

            var label10 = new Label();

            label10.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label10.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label10.TextColor           = Color.Black;
            label10.BorderThickness     = new Thickness(0, 0, 0, 1);
            label10.Padding             = new Thickness(5, 0);
            label10.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label10.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label10.GridColumn          = 11;
            label10.Border              = new SolidBrush("#000000FF");

            var label11 = new Label();

            label11.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label11.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label11.TextColor           = Color.Black;
            label11.BorderThickness     = new Thickness(0, 0, 0, 1);
            label11.Padding             = new Thickness(5, 0);
            label11.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label11.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label11.GridColumn          = 12;
            label11.Border              = new SolidBrush("#000000FF");

            var label12 = new Label();

            label12.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label12.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label12.TextColor           = Color.Black;
            label12.BorderThickness     = new Thickness(0, 0, 0, 1);
            label12.Padding             = new Thickness(5, 0);
            label12.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label12.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label12.GridColumn          = 13;
            label12.Border              = new SolidBrush("#000000FF");

            var label13 = new Label();

            label13.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label13.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label13.TextColor           = Color.Black;
            label13.BorderThickness     = new Thickness(0, 0, 0, 1);
            label13.Padding             = new Thickness(5, 0);
            label13.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label13.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label13.GridColumn          = 14;
            label13.Border              = new SolidBrush("#000000FF");

            var label14 = new Label();

            label14.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label14.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label14.TextColor           = Color.Black;
            label14.BorderThickness     = new Thickness(0, 0, 0, 1);
            label14.Padding             = new Thickness(5, 0);
            label14.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label14.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label14.GridColumn          = 15;
            label14.Border              = new SolidBrush("#000000FF");

            var label15 = new Label();

            label15.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label15.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label15.TextColor           = Color.Black;
            label15.BorderThickness     = new Thickness(0, 0, 0, 1);
            label15.Padding             = new Thickness(5, 0);
            label15.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label15.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label15.GridColumn          = 16;
            label15.Border              = new SolidBrush("#000000FF");

            var label16 = new Label();

            label16.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label16.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label16.TextColor           = Color.Black;
            label16.BorderThickness     = new Thickness(0, 0, 0, 1);
            label16.Padding             = new Thickness(5, 0);
            label16.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label16.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label16.GridColumn          = 17;
            label16.Border              = new SolidBrush("#000000FF");

            var label17 = new Label();

            label17.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label17.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label17.GridColumn          = 5;
            label17.GridRow             = 1;
            label17.Background          = new SolidBrush("#404040FF");

            var label18 = new Label();

            label18.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label18.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label18.GridColumn          = 5;
            label18.GridRow             = 2;
            label18.Background          = new SolidBrush("#404040FF");

            var label19 = new Label();

            label19.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label19.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label19.GridColumn          = 5;
            label19.GridRow             = 3;
            label19.Background          = new SolidBrush("#404040FF");

            var label20 = new Label();

            label20.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label20.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label20.GridColumn          = 5;
            label20.GridRow             = 4;
            label20.Background          = new SolidBrush("#404040FF");

            var label21 = new Label();

            label21.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label21.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label21.GridColumn          = 5;
            label21.GridRow             = 5;
            label21.Background          = new SolidBrush("#404040FF");

            var label22 = new Label();

            label22.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label22.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label22.GridColumn          = 5;
            label22.GridRow             = 6;
            label22.Background          = new SolidBrush("#404040FF");

            var label23 = new Label();

            label23.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label23.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label23.GridColumn          = 5;
            label23.GridRow             = 7;
            label23.Background          = new SolidBrush("#404040FF");

            var label24 = new Label();

            label24.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label24.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label24.GridColumn          = 5;
            label24.GridRow             = 8;
            label24.Background          = new SolidBrush("#404040FF");

            var label25 = new Label();

            label25.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label25.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label25.GridColumn          = 5;
            label25.GridRow             = 9;
            label25.Background          = new SolidBrush("#404040FF");

            var label26 = new Label();

            label26.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label26.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label26.GridColumn          = 5;
            label26.GridRow             = 10;
            label26.Background          = new SolidBrush("#404040FF");

            var label27 = new Label();

            label27.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label27.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label27.GridColumn          = 6;
            label27.GridRow             = 1;
            label27.Background          = new SolidBrush("#404040FF");

            var label28 = new Label();

            label28.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label28.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label28.GridColumn          = 6;
            label28.GridRow             = 2;
            label28.Background          = new SolidBrush("#404040FF");

            var label29 = new Label();

            label29.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label29.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label29.GridColumn          = 6;
            label29.GridRow             = 3;
            label29.Background          = new SolidBrush("#404040FF");

            var label30 = new Label();

            label30.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label30.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label30.GridColumn          = 6;
            label30.GridRow             = 4;
            label30.Background          = new SolidBrush("#404040FF");

            var label31 = new Label();

            label31.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label31.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label31.GridColumn          = 6;
            label31.GridRow             = 5;
            label31.Background          = new SolidBrush("#404040FF");

            var label32 = new Label();

            label32.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label32.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label32.GridColumn          = 6;
            label32.GridRow             = 6;
            label32.Background          = new SolidBrush("#404040FF");

            var label33 = new Label();

            label33.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label33.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label33.GridColumn          = 6;
            label33.GridRow             = 7;
            label33.Background          = new SolidBrush("#404040FF");

            var label34 = new Label();

            label34.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label34.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label34.GridColumn          = 6;
            label34.GridRow             = 8;
            label34.Background          = new SolidBrush("#404040FF");

            var label35 = new Label();

            label35.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label35.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label35.GridColumn          = 6;
            label35.GridRow             = 9;
            label35.Background          = new SolidBrush("#404040FF");

            var label36 = new Label();

            label36.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            label36.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            label36.GridColumn          = 6;
            label36.GridRow             = 10;
            label36.Background          = new SolidBrush("#404040FF");

            gridfirstColumn_label                     = new Label();
            gridfirstColumn_label.Text                = "Valentin";
            gridfirstColumn_label.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            gridfirstColumn_label.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            gridfirstColumn_label.TextColor           = Color.Black;
            gridfirstColumn_label.Padding             = new Thickness(5, 0);
            gridfirstColumn_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            gridfirstColumn_label.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            gridfirstColumn_label.GridRow             = 1;
            gridfirstColumn_label.Id                  = "gridfirstColumn_label";

            var label37 = new Label();

            label37.Text                = "Michel";
            label37.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label37.TextColor           = Color.Black;
            label37.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label37.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label37.GridRow             = 2;

            var label38 = new Label();

            label38.Text                = "Michel";
            label38.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label38.TextColor           = Color.Black;
            label38.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label38.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label38.GridRow             = 3;

            var label39 = new Label();

            label39.Text                = "Michel";
            label39.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label39.TextColor           = Color.Black;
            label39.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label39.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label39.GridRow             = 4;

            var label40 = new Label();

            label40.Text                = "Michel";
            label40.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label40.TextColor           = Color.Black;
            label40.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label40.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label40.GridRow             = 5;

            var label41 = new Label();

            label41.Text                = "Michel";
            label41.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label41.TextColor           = Color.Black;
            label41.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label41.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label41.GridRow             = 6;

            var label42 = new Label();

            label42.Text                = "Michel";
            label42.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label42.TextColor           = Color.Black;
            label42.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label42.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label42.GridRow             = 7;

            var label43 = new Label();

            label43.Text                = "Michel";
            label43.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label43.TextColor           = Color.Black;
            label43.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label43.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label43.GridRow             = 8;

            var label44 = new Label();

            label44.Text                = "Michel";
            label44.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label44.TextColor           = Color.Black;
            label44.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label44.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label44.GridRow             = 9;

            var label45 = new Label();

            label45.Text                = "Michel";
            label45.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt");
            label45.TextColor           = Color.Black;
            label45.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label45.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            label45.GridRow             = 10;


            ShowGridLines  = true;
            GridLinesColor = Color.Black;
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            Background = new SolidBrush("#FFFFFFFF");
            Id         = "score_grid";
            Widgets.Add(gridcontent_label);
            Widgets.Add(gridfirstcolumn_label);
            Widgets.Add(gridfirstrowmovablecolumns_label);
            Widgets.Add(graycell_label);
            Widgets.Add(label1);
            Widgets.Add(label2);
            Widgets.Add(label3);
            Widgets.Add(label4);
            Widgets.Add(label5);
            Widgets.Add(movecolumnleft_button);
            Widgets.Add(movecolumnright_button);
            Widgets.Add(label6);
            Widgets.Add(label7);
            Widgets.Add(label8);
            Widgets.Add(label9);
            Widgets.Add(label10);
            Widgets.Add(label11);
            Widgets.Add(label12);
            Widgets.Add(label13);
            Widgets.Add(label14);
            Widgets.Add(label15);
            Widgets.Add(label16);
            Widgets.Add(label17);
            Widgets.Add(label18);
            Widgets.Add(label19);
            Widgets.Add(label20);
            Widgets.Add(label21);
            Widgets.Add(label22);
            Widgets.Add(label23);
            Widgets.Add(label24);
            Widgets.Add(label25);
            Widgets.Add(label26);
            Widgets.Add(label27);
            Widgets.Add(label28);
            Widgets.Add(label29);
            Widgets.Add(label30);
            Widgets.Add(label31);
            Widgets.Add(label32);
            Widgets.Add(label33);
            Widgets.Add(label34);
            Widgets.Add(label35);
            Widgets.Add(label36);
            Widgets.Add(gridfirstColumn_label);
            Widgets.Add(label37);
            Widgets.Add(label38);
            Widgets.Add(label39);
            Widgets.Add(label40);
            Widgets.Add(label41);
            Widgets.Add(label42);
            Widgets.Add(label43);
            Widgets.Add(label44);
            Widgets.Add(label45);
        }
        private void BuildUI()
        {
            var textBlock1 = new TextBlock();

            textBlock1.Text    = "Class Name:";
            textBlock1.Id      = "";
            textBlock1.GridRow = 1;

            _textClassName            = new TextField();
            _textClassName.Text       = "";
            _textClassName.Id         = "_textClassName";
            _textClassName.GridColumn = 1;
            _textClassName.GridRow    = 1;

            var textBlock2 = new TextBlock();

            textBlock2.Text    = "Output Path:";
            textBlock2.GridRow = 2;

            _textOutputPath            = new TextField();
            _textOutputPath.Text       = "";
            _textOutputPath.Id         = "_textOutputPath";
            _textOutputPath.GridColumn = 1;
            _textOutputPath.GridRow    = 2;

            _buttonChangeOutputPath            = new TextButton();
            _buttonChangeOutputPath.Text       = "Change...";
            _buttonChangeOutputPath.Id         = "_buttonChangeOutputPath";
            _buttonChangeOutputPath.GridColumn = 2;
            _buttonChangeOutputPath.GridRow    = 2;

            var textBlock3 = new TextBlock();

            textBlock3.Text = "Namespace:";

            _textNamespace            = new TextField();
            _textNamespace.Text       = "";
            _textNamespace.Id         = "_textNamespace";
            _textNamespace.GridColumn = 1;


            ColumnSpacing = 8;
            RowSpacing    = 8;
            ColumnsProportions.Add(new Grid.Proportion());
            ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            ColumnsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            Id    = "Root";
            Width = 800;
            Widgets.Add(textBlock1);
            Widgets.Add(_textClassName);
            Widgets.Add(textBlock2);
            Widgets.Add(_textOutputPath);
            Widgets.Add(_buttonChangeOutputPath);
            Widgets.Add(textBlock3);
            Widgets.Add(_textNamespace);
        }
예제 #10
0
        private void BuildUI()
        {
            _ipLabel      = new Label();
            _ipLabel.Text = "IP Address:";
            _ipLabel.Id   = "_ipLabel";

            _ipAddressInput            = new TextBox();
            _ipAddressInput.Text       = "localhost";
            _ipAddressInput.MinWidth   = 150;
            _ipAddressInput.GridColumn = 1;
            _ipAddressInput.Id         = "_ipAddressInput";

            _portLabel         = new Label();
            _portLabel.Text    = "Port:";
            _portLabel.GridRow = 1;
            _portLabel.Id      = "_portLabel";

            _portInput            = new TextBox();
            _portInput.Text       = "27017";
            _portInput.MinWidth   = 150;
            _portInput.GridColumn = 1;
            _portInput.GridRow    = 1;
            _portInput.Id         = "_portInput";

            _usernameLabel         = new Label();
            _usernameLabel.Text    = "Username:"******"_usernameLabel";

            _usernameInput            = new TextBox();
            _usernameInput.Text       = "username";
            _usernameInput.MinWidth   = 150;
            _usernameInput.GridColumn = 1;
            _usernameInput.GridRow    = 2;
            _usernameInput.Id         = "_usernameInput";

            _passwordLabel         = new Label();
            _passwordLabel.Text    = "Password:"******"_passwordLabel";

            _passwordInput = new TextBox();
            _passwordInput.PasswordField = true;
            _passwordInput.MinWidth      = 150;
            _passwordInput.GridColumn    = 1;
            _passwordInput.GridRow       = 3;
            _passwordInput.Id            = "_passwordInput";

            _connectButton         = new TextButton();
            _connectButton.Text    = "Connect";
            _connectButton.GridRow = 4;
            _connectButton.Id      = "_connectButton";

            _statusLabel            = new Label();
            _statusLabel.Text       = "Status:";
            _statusLabel.MinWidth   = 150;
            _statusLabel.GridColumn = 1;
            _statusLabel.GridRow    = 4;
            _statusLabel.Id         = "_statusLabel";

            _backButton         = new TextButton();
            _backButton.Text    = "Back";
            _backButton.GridRow = 5;
            _backButton.Id      = "_backButton";


            ShowGridLines = true;
            ColumnSpacing = 8;
            RowSpacing    = 8;
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            Widgets.Add(_ipLabel);
            Widgets.Add(_ipAddressInput);
            Widgets.Add(_portLabel);
            Widgets.Add(_portInput);
            Widgets.Add(_usernameLabel);
            Widgets.Add(_usernameInput);
            Widgets.Add(_passwordLabel);
            Widgets.Add(_passwordInput);
            Widgets.Add(_connectButton);
            Widgets.Add(_statusLabel);
            Widgets.Add(_backButton);
        }
예제 #11
0
        private void BuildUI()
        {
            HideFolders            = new TextButton();
            HideFolders.Text       = "Hide folders";
            HideFolders.TextColor  = Color.White;
            HideFolders.Toggleable = true;
            HideFolders.Padding    = new Thickness(5);
            HideFolders.Id         = "HideFolders";

            var label1 = new Label();

            label1.Text = "Sort by:";
            label1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Right;
            label1.GridColumn          = 1;

            SortMode = new ComboBox();
            SortMode.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Right;
            SortMode.GridColumn          = 2;
            SortMode.Id = "SortMode";

            var grid1 = new Grid();

            grid1.ColumnSpacing = 8;
            grid1.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            grid1.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            grid1.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            grid1.Widgets.Add(HideFolders);
            grid1.Widgets.Add(label1);
            grid1.Widgets.Add(SortMode);

            LevelScrollViewer         = new ScrollViewer();
            LevelScrollViewer.Content = null;
            LevelScrollViewer.ShowHorizontalScrollBar = false;
            LevelScrollViewer.Id = "LevelScrollViewer";

            Back           = new TextButton();
            Back.Text      = "< Back to title";
            Back.TextColor = Color.White;
            Back.Padding   = new Thickness(5);
            Back.Id        = "Back";

            var verticalStackPanel1 = new VerticalStackPanel();

            verticalStackPanel1.Spacing = 8;
            verticalStackPanel1.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            verticalStackPanel1.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            verticalStackPanel1.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            verticalStackPanel1.Widgets.Add(grid1);
            verticalStackPanel1.Widgets.Add(LevelScrollViewer);
            verticalStackPanel1.Widgets.Add(Back);

            HeartImg = new Image();
            HeartImg.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
            HeartImg.Id = "HeartImg";

            Title      = new Label();
            Title.Text = "Title";
            Title.AutoEllipsisMethod = Myra.Graphics2D.UI.AutoEllipsisMethod.Character;
            Title.Id = "Title";

            var horizontalStackPanel1 = new HorizontalStackPanel();

            horizontalStackPanel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left;
            horizontalStackPanel1.Widgets.Add(HeartImg);
            horizontalStackPanel1.Widgets.Add(Title);

            Artist      = new Label();
            Artist.Text = "Artist";
            Artist.AutoEllipsisMethod = Myra.Graphics2D.UI.AutoEllipsisMethod.Character;
            Artist.Id = "Artist";

            Difficulty      = new Label();
            Difficulty.Text = "OOOOO";
            Difficulty.Id   = "Difficulty";

            Subtitle      = new Label();
            Subtitle.Text = "Subtitle";
            Subtitle.Id   = "Subtitle";

            var horizontalStackPanel2 = new HorizontalStackPanel();

            horizontalStackPanel2.Spacing             = 5;
            horizontalStackPanel2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left;
            horizontalStackPanel2.Widgets.Add(Difficulty);
            horizontalStackPanel2.Widgets.Add(Subtitle);

            Length      = new Label();
            Length.Text = "2:34";
            Length.Id   = "Length";

            Creator      = new Label();
            Creator.Text = "NotBean";
            Creator.Id   = "Creator";

            var horizontalStackPanel3 = new HorizontalStackPanel();

            horizontalStackPanel3.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left;
            horizontalStackPanel3.Widgets.Add(Length);
            horizontalStackPanel3.Widgets.Add(Creator);

            Play           = new TextButton();
            Play.Text      = "Play";
            Play.TextColor = Color.White;
            Play.Padding   = new Thickness(5);
            Play.Id        = "Play";

            Mods           = new TextButton();
            Mods.Text      = "Mods";
            Mods.TextColor = Color.White;
            Mods.Padding   = new Thickness(5);
            Mods.Id        = "Mods";

            LevelSettings           = new TextButton();
            LevelSettings.Text      = "Level settings";
            LevelSettings.TextColor = Color.White;
            LevelSettings.Padding   = new Thickness(5);
            LevelSettings.Id        = "LevelSettings";

            var horizontalStackPanel4 = new HorizontalStackPanel();

            horizontalStackPanel4.Spacing = 5;
            horizontalStackPanel4.Padding = new Thickness(0, 2, 0, 0);
            horizontalStackPanel4.Widgets.Add(Mods);
            horizontalStackPanel4.Widgets.Add(LevelSettings);

            var verticalStackPanel2 = new VerticalStackPanel();

            verticalStackPanel2.Spacing = 4;
            verticalStackPanel2.Widgets.Add(horizontalStackPanel1);
            verticalStackPanel2.Widgets.Add(Artist);
            verticalStackPanel2.Widgets.Add(horizontalStackPanel2);
            verticalStackPanel2.Widgets.Add(horizontalStackPanel3);
            verticalStackPanel2.Widgets.Add(Play);
            verticalStackPanel2.Widgets.Add(horizontalStackPanel4);

            ScoresHeader      = new Label("Header");
            ScoresHeader.Text = "Scores";
            ScoresHeader.Id   = "ScoresHeader";

            ScoresContainer            = new Grid();
            ScoresContainer.RowSpacing = 5;
            ScoresContainer.DefaultColumnProportion = new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Pixels,
                Value = 300,
            };
            ScoresContainer.Id = "ScoresContainer";

            var scrollViewer1 = new ScrollViewer();

            scrollViewer1.ShowHorizontalScrollBar = false;
            scrollViewer1.Content = ScoresContainer;

            var verticalStackPanel3 = new VerticalStackPanel();

            verticalStackPanel3.Widgets.Add(ScoresHeader);
            verticalStackPanel3.Widgets.Add(scrollViewer1);

            DetailsHeader      = new Label("Header");
            DetailsHeader.Text = "Details";
            DetailsHeader.Id   = "DetailsHeader";

            Playcount    = new Label();
            Playcount.Id = "Playcount";

            var verticalStackPanel4 = new VerticalStackPanel();

            verticalStackPanel4.Widgets.Add(DetailsHeader);
            verticalStackPanel4.Widgets.Add(Playcount);

            var horizontalStackPanel5 = new HorizontalStackPanel();

            horizontalStackPanel5.Spacing = 8;
            horizontalStackPanel5.Proportions.Add(new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Pixels,
                Value = 300,
            });
            horizontalStackPanel5.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            horizontalStackPanel5.Margin = new Thickness(0, 40, 0, 0);
            horizontalStackPanel5.Widgets.Add(verticalStackPanel3);
            horizontalStackPanel5.Widgets.Add(verticalStackPanel4);

            LevelInfo                     = new VerticalStackPanel();
            LevelInfo.Spacing             = 8;
            LevelInfo.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left;
            LevelInfo.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Top;
            LevelInfo.GridColumn          = 1;
            LevelInfo.Id                  = "LevelInfo";
            LevelInfo.Widgets.Add(verticalStackPanel2);
            LevelInfo.Widgets.Add(horizontalStackPanel5);


            ColumnSpacing        = 10;
            DefaultRowProportion = new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            };
            ColumnsProportions.Add(new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Pixels,
                Value = 530,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            Padding = new Thickness(10);
            Widgets.Add(verticalStackPanel1);
            Widgets.Add(LevelInfo);
        }
예제 #12
0
        private void BuildUI()
        {
            var label1 = new Label();

            label1.Text = "Blackhole";
            label1.Font = GameManager.Content.Load <SpriteFont>("Fonts/Iceberg32");
            label1.DisabledTextColor = Color.White;
            label1.OverTextColor     = new Color
            {
                B = 255,
                G = 255,
                R = 255,
                A = 0,
            };
            label1.Margin = new Thickness(0, 20, 0, 0);
            label1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label1.OverBackground      = new SolidBrush("#00000000");

            var textBox1 = new TextBox();

            textBox1.Text = "Username";
            textBox1.Font = GameManager.Content.Load <SpriteFont>("Fonts/Iceberg24");
            textBox1.TextVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
            textBox1.HorizontalAlignment   = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            textBox1.Width      = 200;
            textBox1.Height     = 40;
            textBox1.Background = new SolidBrush("#1C1C1CFF");

            var textBox2 = new TextBox();

            textBox2.Text                  = "Password";
            textBox2.Font                  = GameManager.Content.Load <SpriteFont>("Fonts/Iceberg24");
            textBox2.PasswordField         = true;
            textBox2.TextVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
            textBox2.HorizontalAlignment   = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            textBox2.Width                 = 200;
            textBox2.Height                = 40;
            textBox2.Margin                = new Thickness(0, 45, 0, 0);
            textBox2.GridRow               = 1;
            textBox2.Background            = new SolidBrush("#1C1C1FFF");

            LoginButton        = new TextButton();
            LoginButton.Text   = "Login";
            LoginButton.Font   = GameManager.Content.Load <SpriteFont>("Fonts/Iceberg24");
            LoginButton.Width  = 200;
            LoginButton.Height = 40;
            LoginButton.Margin = new Thickness(0, 90, 0, 0);
            LoginButton.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            LoginButton.GridRow             = 2;

            var panel1 = new Panel();

            panel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            panel1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            panel1.Margin          = new Thickness(0, 50, 0, 0);
            panel1.BorderThickness = new Thickness(1);
            panel1.Padding         = new Thickness(20);
            panel1.GridColumn      = 1;
            panel1.Background      = new SolidBrush("#000000FF");
            panel1.Border          = new SolidBrush("#FFFFFFFF");
            panel1.Widgets.Add(textBox1);
            panel1.Widgets.Add(textBox2);
            panel1.Widgets.Add(LoginButton);

            var panel2 = new Panel();

            panel2.BorderThickness = new Thickness(2);
            panel2.GridColumn      = 1;
            panel2.GridRow         = 1;
            panel2.Background      = new SolidBrush("#0F002DFF");
            panel2.Border          = new SolidBrush("#FFFFFFFF");
            panel2.Widgets.Add(label1);
            panel2.Widgets.Add(panel1);


            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Pixels,
                Value = 400,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            RowsProportions.Add(new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Pixels,
                Value = 300,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            Widgets.Add(panel2);
        }
예제 #13
0
        private void BuildUI()
        {
            var label1 = new Label();

            label1.Text = "Inputs";

            var label2 = new Label();

            label2.Text       = "Outputs";
            label2.GridColumn = 1;

            _inputList    = new ListBox();
            _inputList.Id = "_inputList";

            var scrollViewer1 = new ScrollViewer();

            scrollViewer1.MaxHeight = 150;
            scrollViewer1.GridRow   = 1;
            scrollViewer1.Content   = _inputList;

            _outputList    = new ListBox();
            _outputList.Id = "_outputList";

            var scrollViewer2 = new ScrollViewer();

            scrollViewer2.MaxHeight  = 150;
            scrollViewer2.GridColumn = 1;
            scrollViewer2.GridRow    = 1;
            scrollViewer2.Content    = _outputList;

            _removeSelectedInput         = new TextButton();
            _removeSelectedInput.Text    = "Remove Selected";
            _removeSelectedInput.GridRow = 2;
            _removeSelectedInput.Id      = "_removeSelectedInput";

            _removeSelectedOutput            = new TextButton();
            _removeSelectedOutput.Text       = "Remove Selected";
            _removeSelectedOutput.GridColumn = 1;
            _removeSelectedOutput.GridRow    = 2;
            _removeSelectedOutput.Id         = "_removeSelectedOutput";

            _addInputButton         = new TextButton();
            _addInputButton.Text    = "Add Input";
            _addInputButton.GridRow = 3;
            _addInputButton.Id      = "_addInputButton";

            _addOutputButton            = new TextButton();
            _addOutputButton.Text       = "Add Output";
            _addOutputButton.GridColumn = 1;
            _addOutputButton.GridRow    = 3;
            _addOutputButton.Id         = "_addOutputButton";


            ShowGridLines = true;
            ColumnSpacing = 8;
            RowSpacing    = 8;
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            Widgets.Add(label1);
            Widgets.Add(label2);
            Widgets.Add(scrollViewer1);
            Widgets.Add(scrollViewer2);
            Widgets.Add(_removeSelectedInput);
            Widgets.Add(_removeSelectedOutput);
            Widgets.Add(_addInputButton);
            Widgets.Add(_addOutputButton);
        }
예제 #14
0
        private void BuildUI()
        {
            _tagTextBox = new TextBox();
            _tagTextBox.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _tagTextBox.MinWidth            = 150;
            _tagTextBox.Id = "_tagTextBox";

            _setTagButton            = new TextButton();
            _setTagButton.Text       = "Set Tag";
            _setTagButton.GridColumn = 1;
            _setTagButton.Id         = "_setTagButton";

            _addComponentButton         = new TextButton();
            _addComponentButton.Text    = "Add Component...";
            _addComponentButton.GridRow = 1;
            _addComponentButton.Id      = "_addComponentButton";

            _removeComponentButton            = new TextButton();
            _removeComponentButton.Text       = "Remove Component...";
            _removeComponentButton.GridColumn = 1;
            _removeComponentButton.GridRow    = 1;
            _removeComponentButton.Id         = "_removeComponentButton";

            _deleteEntityButton         = new TextButton();
            _deleteEntityButton.Text    = "Delete Entity";
            _deleteEntityButton.GridRow = 2;
            _deleteEntityButton.Id      = "_deleteEntityButton";

            _addChildButton            = new TextButton();
            _addChildButton.Text       = "Add Child";
            _addChildButton.GridColumn = 1;
            _addChildButton.GridRow    = 2;
            _addChildButton.Id         = "_addChildButton";


            ColumnSpacing = 8;
            RowSpacing    = 8;
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            BorderThickness = new Thickness(8);
            Widgets.Add(_tagTextBox);
            Widgets.Add(_setTagButton);
            Widgets.Add(_addComponentButton);
            Widgets.Add(_removeComponentButton);
            Widgets.Add(_deleteEntityButton);
            Widgets.Add(_addChildButton);
        }
예제 #15
0
        private void BuildUI()
        {
            BarLeft            = new Panel();
            BarLeft.Background = new SolidBrush("#213043FF");
            BarLeft.Id         = "BarLeft";

            BarRight            = new Panel();
            BarRight.GridColumn = 1;
            BarRight.Background = new SolidBrush("#213043FF");
            BarRight.Id         = "BarRight";

            var label1 = new Label();

            label1.Text    = "Pokemon Blue";
            label1.Padding = new Thickness(35, 35, 0, 35);

            var PlayButton = new TextButton();

            PlayButton.Text       = "Play";
            PlayButton.Margin     = new Thickness(0, 23, 0, 0);
            PlayButton.Padding    = new Thickness(40, 15, 40, 10);
            PlayButton.GridColumn = 1;
            PlayButton.Background = new SolidBrush("#743897FF");
            PlayButton.TouchDown += PlayRom;
            var grid1 = new Grid();

            grid1.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            grid1.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            //grid1.Widgets.Add(label1);
            grid1.Widgets.Add(PlayButton);

            var panel1 = new Panel();

            panel1.Background = new SolidBrush("#162539");
            panel1.Widgets.Add(grid1);

            var label2 = new Label();

            label2.Text = "Your Library";

            var panel2 = new Panel();

            panel2.Margin     = new Thickness(60);
            panel2.Background = new SolidBrush("#1D2F47FF");
            panel2.Widgets.Add(label2);

            var verticalStackPanel1 = new VerticalStackPanel();

            verticalStackPanel1.Widgets.Add(panel1);
            verticalStackPanel1.Widgets.Add(panel2);

            MainArea            = new Panel();
            MainArea.GridColumn = 1;
            MainArea.GridRow    = 1;
            MainArea.Background = new SolidBrush("#1D2F47");
            MainArea.Id         = " MainArea";
            MainArea.Widgets.Add(verticalStackPanel1);

            var textButton2 = new TextButton();

            textButton2.Text       = "Play";
            textButton2.MinWidth   = 500;
            textButton2.Padding    = new Thickness(0, 29);
            textButton2.Background = new SolidBrush("#232B38FF");

            var textButton3 = new TextButton();

            textButton3.Text       = "Joy Pad";
            textButton3.MinWidth   = 500;
            textButton3.Padding    = new Thickness(0, 29);
            textButton3.Background = new SolidBrush("#232B38FF");

            var textButton4 = new TextButton();

            textButton4.Text       = "System";
            textButton4.MinWidth   = 500;
            textButton4.Padding    = new Thickness(0, 29);
            textButton4.Background = new SolidBrush("#232B38FF");

            var textButton5 = new TextButton();

            textButton5.Text       = "About";
            textButton5.MinWidth   = 500;
            textButton5.Padding    = new Thickness(0, 29);
            textButton5.Background = new SolidBrush("#232B38FF");

            var verticalStackPanel2 = new VerticalStackPanel();

            verticalStackPanel2.Widgets.Add(textButton2);
            verticalStackPanel2.Widgets.Add(textButton3);
            verticalStackPanel2.Widgets.Add(textButton4);
            verticalStackPanel2.Widgets.Add(textButton5);

            MenuBar            = new Panel();
            MenuBar.GridRow    = 1;
            MenuBar.Background = new SolidBrush("#08111F");
            MenuBar.Id         = "MenuBar";
            MenuBar.Widgets.Add(verticalStackPanel2);


            ColumnsProportions.Add(new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Part,
                Value = 3,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Part,
                Value = 16,
            });
            RowsProportions.Add(new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Part,
                Value = 2,
            });
            RowsProportions.Add(new Proportion
            {
                Type  = Myra.Graphics2D.UI.ProportionType.Part,
                Value = 19,
            });
            Widgets.Add(BarLeft);
            Widgets.Add(BarRight);
            Widgets.Add(MainArea);
            Widgets.Add(MenuBar);
        }
예제 #16
0
        public GridTabPage()
        {
            RowSpacing    = 3;
            ColumnSpacing = 3;

            ColumnsProportions.Add(new Proportion(ProportionType.Auto));
            ColumnsProportions.Add(new Proportion(ProportionType.Auto));
            ColumnsProportions.Add(new Proportion(ProportionType.Part, 1.0f));
            ColumnsProportions.Add(new Proportion(ProportionType.Part, 2.0f));
            ColumnsProportions.Add(new Proportion(ProportionType.Pixels, 150.0f));
            ColumnsProportions.Add(new Proportion(ProportionType.Auto));
            ColumnsProportions.Add(new Proportion(ProportionType.Fill));

            RowsProportions.Add(new Proportion(ProportionType.Auto));
            RowsProportions.Add(new Proportion(ProportionType.Auto));
            RowsProportions.Add(new Proportion(ProportionType.Part, 1.0f));
            RowsProportions.Add(new Proportion(ProportionType.Part, 1.0f));
            RowsProportions.Add(new Proportion(ProportionType.Pixels, 200.0f));
            RowsProportions.Add(new Proportion(ProportionType.Auto));
            RowsProportions.Add(new Proportion(ProportionType.Fill));

            // Create headers
            for (var i = 1; i < ColumnsProportions.Count; ++i)
            {
                var header = new TextBlock
                {
                    Text       = ColumnsProportions[i].ToString(),
                    GridColumn = i,
                    GridRow    = 0
                };

                Widgets.Add(header);
            }

            // Combo
            var combo = new ComboBox
            {
                GridColumn = 1,
                GridRow    = 1
            };

            combo.Items.Add(new ListItem("Red", Color.Red));
            combo.Items.Add(new ListItem("Green", Color.Green));
            combo.Items.Add(new ListItem("Blue", Color.Blue));
            Widgets.Add(combo);

            // Button
            var button = new Button
            {
                GridColumn          = 2,
                GridRow             = 1,
                GridColumnSpan      = 2,
                GridRowSpan         = 1,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Text = "This is 2 columns button"
            };

            button.Click += (s, a) =>
            {
                var messageBox = Dialog.CreateMessageBox("2C", "2 Columns Button pushed!");
                messageBox.ShowModal(Desktop);
            };

            Widgets.Add(button);

            // Button
            var button2 = new Button
            {
                GridColumn          = 2,
                GridRow             = 2,
                GridColumnSpan      = 1,
                GridRowSpan         = 2,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Text = "This is 2 rows button"
            };

            button2.Click += (s, a) =>
            {
                var messageBox = Dialog.CreateMessageBox("2R", "2 Rows Button pushed!");
                messageBox.ShowModal(Desktop);
            };
            Widgets.Add(button2);

            var label = new TextBlock
            {
                Text =
                    "Lorem ipsum [Green]dolor sit amet, [Red]consectetur adipisicing elit, sed do eiusmod [#AAAAAAAA]tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. [white]Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum!",
                VerticalSpacing = 0,
                TextColor       = Color.AntiqueWhite,
                Wrap            = true
            };

            var pane = new ScrollPane
            {
                Widget = label,
                Width  = 200,
                Height = 200
            };

            _window = new Window
            {
                Title   = "Text",
                Content = pane
            };

            var button3 = new Button
            {
                Text       = "Show Window",
                GridColumn = 4,
                GridRow    = 3
            };

            Widgets.Add(button3);

            button3.Click += (sender, args) =>
            {
                _window.ShowModal(Desktop);
            };

            // Horizontal slider
            var hslider = new HorizontalSlider
            {
                GridColumn = 3,
                GridRow    = 2
            };

            Widgets.Add(hslider);

            // Horizontal slider value
            var hsliderValue = new TextBlock
            {
                GridColumn = 4,
                GridRow    = 2,
                Text       = "HSlider Value: 0"
            };

            hslider.ValueChanged += (sender, args) =>
            {
                hsliderValue.Text = string.Format("HSlider Value: {0:0.00}", hslider.Value);
            };

            Widgets.Add(hsliderValue);

            var textBlock = new TextBlock
            {
                Width      = 125,
                Text       = "This is textblock which spans for several lines to demonstrate row proportion set to Auto",
                GridColumn = 4,
                GridRow    = 1
            };

            Widgets.Add(textBlock);

            var checkBox = new CheckBox
            {
                Text       = "This is a checkbox",
                GridColumn = 3,
                GridRow    = 3,
            };

            Widgets.Add(checkBox);

            // Spin buttons
            var textField = new TextField
            {
                GridColumn = 5,
                GridRow    = 1,
                Width      = 100
            };

            Widgets.Add(textField);

            var spinButton2 = new SpinButton
            {
                GridColumn = 5,
                GridRow    = 2,
                Width      = 100,
                Integer    = true
            };

            Widgets.Add(spinButton2);

            // Progress bars
            var horizontalProgressBar = new HorizontalProgressBar
            {
                GridColumn = 5,
                GridRow    = 3,
                Width      = 100
            };

            Widgets.Add(horizontalProgressBar);

            var verticalProgressBar = new VerticalProgressBar
            {
                GridColumn = 6,
                GridRow    = 1,
                Height     = 100
            };

            Widgets.Add(verticalProgressBar);

            // List box
            var list = new ListBox
            {
                GridColumn = 5,
                GridRow    = 4
            };

            list.Items.Add(new ListItem("Red", Color.Red));
            list.Items.Add(new ListItem("Green", Color.Green));
            list.Items.Add(new ListItem("Blue", Color.Blue));
            Widgets.Add(list);

            // Vertical slider
            var vslider = new VerticalSlider
            {
                GridColumn = 2,
                GridRow    = 4
            };

            Widgets.Add(vslider);

            // Vertical slider value
            var vsliderValue = new TextBlock
            {
                GridColumn = 4,
                GridRow    = 4,
                Text       = "VSlider Value: 0"
            };

            vslider.ValueChanged += (sender, args) =>
            {
                vsliderValue.Text = string.Format("VSlider Value: {0:0.00}", vslider.Value);
            };

            Widgets.Add(vsliderValue);

            var tree = new Tree
            {
                HasRoot    = false,
                GridColumn = 3,
                GridRow    = 4
            };
            var node1 = tree.AddSubNode("node1");
            var node2 = node1.AddSubNode("node2");
            var node3 = node2.AddSubNode("node3");

            node3.AddSubNode("node4");
            node3.AddSubNode("node5");
            node2.AddSubNode("node6");

            Widgets.Add(tree);

            var textBlock2 = new TextBlock
            {
                Text       = "This is long textblock",
                GridColumn = 1,
                GridRow    = 4
            };

            Widgets.Add(textBlock2);

            var hsplitPane = new HorizontalSplitPane
            {
                GridColumn = 1,
                GridRow    = 5
            };
            var hsplitPaneLabel1 = new TextBlock
            {
                Text = "Left"
            };

            hsplitPane.Widgets.Add(hsplitPaneLabel1);
            var hsplitPaneLabel2 = new TextBlock
            {
                Text = "Right"
            };

            hsplitPane.Widgets.Add(hsplitPaneLabel2);
            Widgets.Add(hsplitPane);

            var vsplitPane = new VerticalSplitPane
            {
                GridColumn = 6,
                GridRow    = 4
            };
            var vsplitPaneLabel1 = new TextBlock
            {
                Text = "Top"
            };

            vsplitPane.Widgets.Add(vsplitPaneLabel1);
            var vsplitPaneLabel2 = new TextBlock
            {
                Text = "Bottom"
            };

            vsplitPane.Widgets.Add(vsplitPaneLabel2);
            Widgets.Add(vsplitPane);

            for (var i = 1; i < RowsProportions.Count; ++i)
            {
                var header = new TextBlock
                {
                    Text       = RowsProportions[i].ToString(),
                    GridColumn = 0,
                    GridRow    = i
                };

                Widgets.Add(header);
            }
        }
예제 #17
0
        private void BuildUI()
        {
            var textBlock1 = new TextBlock();

            textBlock1.Text          = "Class Name:";
            textBlock1.Id            = "";
            textBlock1.GridPositionY = 1;

            _textClassName      = new TextField();
            _textClassName.Text = "";
            _textClassName.Id   = "_textClassName";
            _textClassName.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _textClassName.GridPositionX       = 1;
            _textClassName.GridPositionY       = 1;
            _textClassName.ClipToBounds        = true;
            _textClassName.CanFocus            = true;

            var textBlock2 = new TextBlock();

            textBlock2.Text          = "Output Path:";
            textBlock2.GridPositionY = 2;

            _textOutputPath      = new TextField();
            _textOutputPath.Text = "";
            _textOutputPath.Id   = "_textOutputPath";
            _textOutputPath.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _textOutputPath.GridPositionX       = 1;
            _textOutputPath.GridPositionY       = 2;
            _textOutputPath.ClipToBounds        = true;
            _textOutputPath.CanFocus            = true;

            _buttonChangeOutputPath      = new Button();
            _buttonChangeOutputPath.Text = "Change...";
            _buttonChangeOutputPath.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _buttonChangeOutputPath.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _buttonChangeOutputPath.Id            = "_buttonChangeOutputPath";
            _buttonChangeOutputPath.GridPositionX = 2;
            _buttonChangeOutputPath.GridPositionY = 2;

            var textBlock3 = new TextBlock();

            textBlock3.Text = "Namespace:";

            _textNamespace      = new TextField();
            _textNamespace.Text = "";
            _textNamespace.Id   = "_textNamespace";
            _textNamespace.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _textNamespace.GridPositionX       = 1;
            _textNamespace.ClipToBounds        = true;
            _textNamespace.CanFocus            = true;


            DrawLinesColor = Color.White;
            ColumnSpacing  = 8;
            RowSpacing     = 8;
            ColumnsProportions.Add(new Grid.Proportion());
            ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            ColumnsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            Id                  = "Root";
            WidthHint           = 800;
            HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            Widgets.Add(textBlock1);
            Widgets.Add(_textClassName);
            Widgets.Add(textBlock2);
            Widgets.Add(_textOutputPath);
            Widgets.Add(_buttonChangeOutputPath);
            Widgets.Add(textBlock3);
            Widgets.Add(_textNamespace);
        }