Ejemplo n.º 1
0
        private void NewItemOnClicked(object sender, EventArgs eventArgs)
        {
            var dlg = new NewProjectWizard();

            dlg.Closed += (s, a) =>
            {
                if (!dlg.Result)
                {
                    return;
                }

                Container rootWidget = null;

                if (dlg._radioButtonGrid.IsPressed)
                {
                    rootWidget = new Grid();
                }
                else
                if (dlg._radioButtonPanel.IsPressed)
                {
                    rootWidget = new Panel();
                }
                else
                if (dlg._radioButtonScrollPane.IsPressed)
                {
                    rootWidget = new ScrollPane();
                }
                else
                if (dlg._radioButtonHorizontalSplitPane.IsPressed)
                {
                    rootWidget = new HorizontalSplitPane();
                }
                else
                if (dlg._radioButtonVerticalSplitPane.IsPressed)
                {
                    rootWidget = new VerticalSplitPane();
                }
                else
                if (dlg._radioButtonWindow.IsPressed)
                {
                    rootWidget = new Window();
                }
                else
                if (dlg._radioButtonDialog.IsPressed)
                {
                    rootWidget = new Dialog();
                }

                New(rootWidget);
            };

            dlg.ShowModal(_desktop);
        }
Ejemplo n.º 2
0
        private void initializeItemTable()
        {
            itemsTable = new Table();
            var windowFrame = Core.content.Load <Texture2D>("UI/window_frame_grey");
            var buttonFrame = Core.content.Load <Texture2D>("UI/frame_grey");

            var back = new SubtextureDrawable(new Nez.Textures.Subtexture(windowFrame));

            back.setPadding(0, 620, 0, 540);
            itemsTable.setBackground(back);

            allContain.add(itemsTable).top().left().pad(25);

            var table = new Table();

            table.setFillParent(true).top().left();
            var itemScrollPane = new ScrollPane(table, Skin.createDefaultSkin());

            itemsTable.addElement(itemScrollPane).setPosition(30, 30).fillParent = true;

            ButtonGroup buttonGroup = new ButtonGroup();

            int counts = 0;
            var items  = player.items.Keys.Where(m => m.types == ItemComponent.ItemTypes.Material || m.types == ItemComponent.ItemTypes.ExecuteableProp).ToList();


            foreach (var item in items)
            {
                var imageUp   = new SubtextureDrawable(item.itemIcon);
                var imageDown = new SubtextureDrawable(item.itemIcon);
                imageDown.tintColor = Color.DarkGray;
                var imageChecked = new SubtextureDrawable(item.itemIcon);
                imageChecked.tintColor = Color.DarkKhaki;
                var button = new ItemIconButton(imageUp, imageDown, imageChecked);
                button.item = item;
                button.setBackground(new SubtextureDrawable(buttonFrame));
                buttonGroup.add(button);
                //button.onClicked += Button_onClicked;
                button.OnMouseEntry += Button_OnMouseEntry;
                button.OnMouseExit  += Button_OnMouseExit;
                counts++;

                table.add(button).size(64);
                if (counts > rowcount)
                {
                    counts = 0;
                    table.row();
                }
            }
        }
Ejemplo n.º 3
0
        // Use this for initialization
        void Start()
        {
            _mainView = this.GetComponent <UIPanel>().ui;
            //player1Controller = GameObject.Find("Player1").GetComponent<RoleController>();

            _list = _mainView.GetChild("list").asList;
            _list.SetVirtualAndLoop();

            _list.itemRenderer = RenderListItem;
            _list.numItems     = 6;
            _list.scrollPane.onScroll.Add(DoSpecialEffect);

            DoSpecialEffect();
            scrollPane            = _list.scrollPane;
            scrollPane.scrollStep = 93f;
        }
Ejemplo n.º 4
0
        private void Tick(object sender, EventArgs e)
        {
            printcher.Advance((float)((DateTime.Now - lastTime).TotalMilliseconds / 1000));

            bindingExp.UpdateTarget();

            ScrollPane.ScrollToEnd();

            lastTime = DateTime.Now;

            if (printcher.IsFinished)
            {
                dispatcherTimer.Stop();
                BindingOperations.ClearAllBindings(Contents);
                Close();
            }
        }
Ejemplo n.º 5
0
        private void initializaDetailTable()
        {
            recipeTable = new Table();
            recipeTable.debugAll();
            var windowFrame = Core.content.Load <Texture2D>("UI/window_frame_grey");

            var back = new SubtextureDrawable(new Nez.Textures.Subtexture(windowFrame));

            back.setPadding(0, 620, 0, 540);
            recipeTable.setBackground(back);

            allContain.add(recipeTable).top().right().pad(25);


            detailScrollPane = new ScrollPane(null, Skin.createDefaultSkin());
            recipeTable.addElement(detailScrollPane).setPosition(30, 30).fillParent = true;

            detailMessageTable = new Table();
            detailScrollPane.setWidget(detailMessageTable);
        }
Ejemplo n.º 6
0
        private void initRecipeDetailTable(Recipe.Recipe recipe = null)
        {
            recipeDetailTable = new Table();
            var back = new SubtextureDrawable(new Nez.Textures.Subtexture(windowFrame));

            back.setPadding(0, 620, 0, 540);
            recipeDetailTable.setBackground(back);

            detailCell = allContain.add(recipeDetailTable).top().right().pad(25);


            recipeDetailContentTable = new Table();
            if (recipe != null)
            {
                bool enable = true;
                foreach (var mater in recipe.rawMaterials)
                {
                    recipeDetailContentTable.add(new Image(mater.material.itemIcon)).size(64);
                    if (player.items.Keys.Where(m => m.id == mater.material.id).Count() > 0)
                    {
                        var item  = player.items.Keys.Where(m => m.id == mater.material.id).First();
                        var label = new Label($"{player.items[item]}/{mater.count}");
                        if (player.items[item] < mater.count)
                        {
                            label.setFontColor(Color.Red);
                            recipeDetailContentTable.add(label);
                            enable = false;
                        }
                        else
                        {
                            recipeDetailContentTable.add(label);
                        }
                    }
                    else
                    {
                        var label = new Label($"0/{mater.count}");
                        label.setFontColor(Color.Red);
                        recipeDetailContentTable.add(label);
                        enable = false;
                    }

                    recipeDetailContentTable.row();
                }
                if (enable)
                {
                    var button = new TextButton("建造", Skin.createDefaultSkin());
                    button.onClicked += btn => {
                        foreach (var mat in recipe.rawMaterials)
                        {
                            player.throwOut(player.items.Keys.Where(m => m.id == mat.material.id).First(), mat.count);
                        }

                        //Core.startCoroutine(createProcessBar(recipe));
                        player.pickUp(recipe.produce, recipe.porduceCount);
                        allContain.clear();
                        initRecipeTable();
                        initRecipeDetailTable(recipe);
                    };
                    recipeDetailContentTable.add(button).width(50).height(20);
                }
                ;
            }

            recipeDetailScrollPane = new ScrollPane(recipeDetailContentTable, Skin.createDefaultSkin());
            recipeDetailTable.addElement(recipeDetailScrollPane).setPosition(30, 30);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Returns the maximum scroll position of the widget
        /// </summary>
        /// <param name="direction"> "x" or "y" for horizontal/vertical maximum </param>
        /// <returns>The maximum scroll position in pixels.</returns>
        public long?GetMaximum(string direction)
        {
            ScrollPane scrollPane = ScrollPane;

            return(scrollPane.GetMaximum(direction));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Returns the current scroll position of the widget
        /// </summary>
        /// <param name="direction"> "x" or "y" for horizontal/vertical position </param>
        /// <returns>The scroll position in pixels.</returns>
        public long?GetScrollPosition(string direction)
        {
            ScrollPane scrollPane = ScrollPane;

            return(scrollPane.GetScrollPosition(direction));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Scrolls the widget to the specified position
        /// </summary>
        /// <param name="direction"> "x" or "y" for horizontal/vertical scrolling </param>
        /// <param name="position"> Position (in pixels) to scroll to </param>
        public void ScrollTo(string direction, int?position)
        {
            ScrollPane scrollPane = ScrollPane;

            scrollPane.ScrollTo(direction, position);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Scrolls the area in the specified direction until the locator finds a child
        /// widget. The locator will be executed in the scroll area's context, so
        /// a relative locator should be used, e.g. <code>By.Qxh("*\/[@label=Foo]")</code>
        /// </summary>
        /// <param name="direction"> "x" or "y" for horizontal/vertical scrolling </param>
        /// <param name="locator"> Child widget locator </param>
        /// <returns>The matching child widget.</returns>
        public IWidget ScrollToChild(string direction, OpenQA.Selenium.By locator)
        {
            ScrollPane scrollPane = ScrollPane;

            return(scrollPane.ScrollToChild(direction, locator));
        }
Ejemplo n.º 11
0
        private void BuildUI()
        {
            var textBlock1 = new TextBlock();

            textBlock1.Text = "Button:";
            textBlock1.Id   = "";

            _button      = new Button();
            _button.Text = "Button";
            _button.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _button.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _button.Id            = "_button";
            _button.PaddingLeft   = 8;
            _button.PaddingRight  = 8;
            _button.GridPositionX = 1;

            _textButtonLabel               = new TextBlock();
            _textButtonLabel.Text          = "Text Button:";
            _textButtonLabel.Id            = "_textButtonLabel";
            _textButtonLabel.GridPositionY = 1;

            _textButton      = new TextButton();
            _textButton.Text = "Text Button";
            _textButton.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _textButton.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _textButton.Id            = "_textButton";
            _textButton.PaddingLeft   = 8;
            _textButton.PaddingRight  = 8;
            _textButton.GridPositionX = 1;
            _textButton.GridPositionY = 1;

            var textBlock2 = new TextBlock();

            textBlock2.Text          = "Image Button:";
            textBlock2.Id            = "";
            textBlock2.GridPositionY = 2;

            _imageButton = new ImageButton();
            _imageButton.ImageVisible = true;
            _imageButton.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _imageButton.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _imageButton.Id            = "_imageButton";
            _imageButton.PaddingLeft   = 8;
            _imageButton.PaddingRight  = 8;
            _imageButton.GridPositionX = 1;
            _imageButton.GridPositionY = 2;

            var checkBox1 = new CheckBox();

            checkBox1.Text                       = "This is checkbox";
            checkBox1.ImageWidthHint             = 10;
            checkBox1.ImageHeightHint            = 10;
            checkBox1.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            checkBox1.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            checkBox1.GridPositionY              = 3;
            checkBox1.GridSpanX                  = 2;

            var textBlock3 = new TextBlock();

            textBlock3.Text          = "Horizontal Slider:";
            textBlock3.Id            = "";
            textBlock3.GridPositionY = 4;

            var horizontalSlider1 = new HorizontalSlider();

            horizontalSlider1.Maximum             = 100;
            horizontalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            horizontalSlider1.GridPositionX       = 1;
            horizontalSlider1.GridPositionY       = 4;

            var textBlock4 = new TextBlock();

            textBlock4.Text          = "Combo Box:";
            textBlock4.GridPositionY = 5;

            var listItem1 = new ListItem();

            listItem1.Id   = "";
            listItem1.Text = "Item 1";

            var listItem2 = new ListItem();

            listItem2.Text = "Item 2";

            var listItem3 = new ListItem();

            listItem3.Text = "Item 3";

            var comboBox1 = new ComboBox();

            comboBox1.WidthHint     = 200;
            comboBox1.GridPositionX = 1;
            comboBox1.GridPositionY = 5;
            comboBox1.Items.Add(listItem1);
            comboBox1.Items.Add(listItem2);
            comboBox1.Items.Add(listItem3);

            var textBlock5 = new TextBlock();

            textBlock5.Text          = "Text Field:";
            textBlock5.GridPositionY = 6;

            var textField1 = new TextField();

            textField1.Text = "";
            textField1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            textField1.GridPositionX       = 1;
            textField1.GridPositionY       = 6;
            textField1.ClipToBounds        = true;
            textField1.CanFocus            = true;

            var textBlock6 = new TextBlock();

            textBlock6.Text          = "List Box:";
            textBlock6.GridPositionY = 7;

            var listItem4 = new ListItem();

            listItem4.Text = "Item 1";

            var listItem5 = new ListItem();

            listItem5.Text = "Item 2";

            var listItem6 = new ListItem();

            listItem6.Text = "Item 3";

            var listBox1 = new ListBox();

            listBox1.DrawLinesColor      = Color.White;
            listBox1.WidthHint           = 200;
            listBox1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            listBox1.GridPositionX       = 1;
            listBox1.GridPositionY       = 7;
            listBox1.Items.Add(listItem4);
            listBox1.Items.Add(listItem5);
            listBox1.Items.Add(listItem6);

            var textBlock7 = new TextBlock();

            textBlock7.Text          = "Tree";
            textBlock7.GridPositionY = 8;

            _gridRight = new Grid();
            _gridRight.DrawLinesColor = Color.White;
            _gridRight.ColumnSpacing  = 8;
            _gridRight.RowSpacing     = 8;
            _gridRight.ColumnsProportions.Add(new Grid.Proportion());
            _gridRight.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.Id = "_gridRight";
            _gridRight.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _gridRight.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _gridRight.Widgets.Add(textBlock1);
            _gridRight.Widgets.Add(_button);
            _gridRight.Widgets.Add(_textButtonLabel);
            _gridRight.Widgets.Add(_textButton);
            _gridRight.Widgets.Add(textBlock2);
            _gridRight.Widgets.Add(_imageButton);
            _gridRight.Widgets.Add(checkBox1);
            _gridRight.Widgets.Add(textBlock3);
            _gridRight.Widgets.Add(horizontalSlider1);
            _gridRight.Widgets.Add(textBlock4);
            _gridRight.Widgets.Add(comboBox1);
            _gridRight.Widgets.Add(textBlock5);
            _gridRight.Widgets.Add(textField1);
            _gridRight.Widgets.Add(textBlock6);
            _gridRight.Widgets.Add(listBox1);
            _gridRight.Widgets.Add(textBlock7);

            var scrollPane1 = new ScrollPane();

            scrollPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            scrollPane1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            scrollPane1.ClipToBounds        = true;
            scrollPane1.CanFocus            = true;
            scrollPane1.Child = _gridRight;

            var textBlock8 = new TextBlock();

            textBlock8.Text = "Vertical Slider:";

            var verticalSlider1 = new VerticalSlider();

            verticalSlider1.Maximum             = 100;
            verticalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            verticalSlider1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            verticalSlider1.GridPositionY       = 1;

            var grid1 = new Grid();

            grid1.DrawLinesColor = Color.White;
            grid1.RowSpacing     = 8;
            grid1.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid1.Widgets.Add(textBlock8);
            grid1.Widgets.Add(verticalSlider1);

            var textBlock9 = new TextBlock();

            textBlock9.Text = "Progress Bars:";

            _horizontalProgressBar                     = new HorizontalProgressBar();
            _horizontalProgressBar.Maximum             = 100;
            _horizontalProgressBar.DrawLinesColor      = Color.White;
            _horizontalProgressBar.Id                  = "_horizontalProgressBar";
            _horizontalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _horizontalProgressBar.GridPositionY       = 1;

            _verticalProgressBar                     = new VerticalProgressBar();
            _verticalProgressBar.Maximum             = 100;
            _verticalProgressBar.DrawLinesColor      = Color.White;
            _verticalProgressBar.Id                  = "_verticalProgressBar";
            _verticalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _verticalProgressBar.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _verticalProgressBar.GridPositionY       = 2;

            var grid2 = new Grid();

            grid2.DrawLinesColor = Color.White;
            grid2.RowSpacing     = 8;
            grid2.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid2.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid2.GridPositionY       = 2;
            grid2.Widgets.Add(textBlock9);
            grid2.Widgets.Add(_horizontalProgressBar);
            grid2.Widgets.Add(_verticalProgressBar);

            var verticalSplitPane1 = new VerticalSplitPane();

            verticalSplitPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            verticalSplitPane1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            verticalSplitPane1.GridPositionX       = 2;
            verticalSplitPane1.Widgets.Add(grid1);
            verticalSplitPane1.Widgets.Add(grid2);


            HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            GridPositionY       = 1;
            Widgets.Add(scrollPane1);
            Widgets.Add(verticalSplitPane1);
        }
Ejemplo n.º 12
0
        private void initPropsDetailTable()
        {
            propsTable = new Table();
            var back = new SubtextureDrawable(new Nez.Textures.Subtexture(windowFrame));

            back.setPadding(0, 620, 0, 540);
            propsTable.setBackground(back);

            allContain.add(propsTable).right().top().pad(25);

            propsDeatilTable = new Table();
            propsDeatilTable.setFillParent(true).top().left();

            ButtonGroup buttonGroup = new ButtonGroup();
            int         counts      = 0;

            var ItemList = player.items.Keys.Where(m => m.types == ItemComponent.ItemTypes.ExecuteableProp).ToList();

            if (player.AProps != null)
            {
                var item = ItemList.Where(m => m.id == player.AProps.id).First();
                ItemList.Remove(item);
            }
            if (player.SProps != null)
            {
                var item = ItemList.Where(m => m.id == player.SProps.id).First();
                ItemList.Remove(item);
            }
            if (player.DProps != null)
            {
                var item = ItemList.Where(m => m.id == player.DProps.id).First();
                ItemList.Remove(item);
            }
            if (player.FProps != null)
            {
                var item = ItemList.Where(m => m.id == player.FProps.id).First();
                ItemList.Remove(item);
            }
            if (player.GProps != null)
            {
                var item = ItemList.Where(m => m.id == player.GProps.id).First();
                ItemList.Remove(item);
            }

            foreach (var item in ItemList)
            {
                var imageUp   = new SubtextureDrawable(item.itemIcon);
                var imageDown = new SubtextureDrawable(item.itemIcon);
                imageDown.tintColor = Color.DarkGray;
                var imageChecked = new SubtextureDrawable(item.itemIcon);
                imageChecked.tintColor = Color.DarkKhaki;
                var button = new ItemIconButton(imageUp, imageDown, imageChecked);
                button.setBackground(new SubtextureDrawable(buttonFrame));
                button.item          = item;
                button.OnMouseEntry += Button_OnMouseEntry;
                button.OnMouseExit  += Button_OnMouseExit;
                button.onClicked    += Button_onClicked;
                buttonGroup.add(button);
                counts++;

                propsDeatilTable.add(button).size(64);
                if (counts > rowcount)
                {
                    counts = 0;
                    propsDeatilTable.row();
                }
            }
            propsScrollPane = new ScrollPane(propsDeatilTable, Skin.createDefaultSkin());

            propsTable.addElement(propsScrollPane).setPosition(30, 30);
            propsScrollPane.setSize(500, 540);
        }
Ejemplo n.º 13
0
        private void BuildUI()
        {
            _buttonBack = new ImageButton();
            _buttonBack.ImageVisible = true;
            _buttonBack.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonBack.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonBack.Id = "_buttonBack";
            _buttonBack.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonBack.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;

            _buttonForward = new ImageButton();
            _buttonForward.ImageVisible = true;
            _buttonForward.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonForward.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonForward.Id = "_buttonForward";
            _buttonForward.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonForward.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonForward.GridPositionX       = 1;

            _textFieldPath                     = new TextField();
            _textFieldPath.Text                = "";
            _textFieldPath.Readonly            = true;
            _textFieldPath.Id                  = "_textFieldPath";
            _textFieldPath.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _textFieldPath.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _textFieldPath.GridPositionX       = 2;
            _textFieldPath.ClipToBounds        = true;
            _textFieldPath.CanFocus            = true;

            _buttonParent = new ImageButton();
            _buttonParent.ImageVisible = true;
            _buttonParent.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonParent.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonParent.Id = "_buttonParent";
            _buttonParent.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonParent.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonParent.GridPositionX       = 3;

            var grid1 = new Grid();

            grid1.DrawLinesColor = Color.White;
            grid1.ColumnSpacing  = 4;
            grid1.ColumnsProportions.Add(new Grid.Proportion());
            grid1.ColumnsProportions.Add(new Grid.Proportion());
            grid1.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.ColumnsProportions.Add(new Grid.Proportion());
            grid1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid1.Widgets.Add(_buttonBack);
            grid1.Widgets.Add(_buttonForward);
            grid1.Widgets.Add(_textFieldPath);
            grid1.Widgets.Add(_buttonParent);

            _listBoxPlaces = new ListBox();
            _listBoxPlaces.DrawLinesColor      = Color.White;
            _listBoxPlaces.Id                  = "_listBoxPlaces";
            _listBoxPlaces.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _listBoxPlaces.ClipToBounds        = true;

            _gridFiles = new Grid();
            _gridFiles.DrawLinesColor = Color.White;
            _gridFiles.ColumnSpacing  = 4;
            _gridFiles.RowSpacing     = 4;
            _gridFiles.ColumnsProportions.Add(new Grid.Proportion());
            _gridFiles.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            _gridFiles.GridSelectionMode = GridSelectionMode.Row;
            _gridFiles.Id = "_gridFiles";
            _gridFiles.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _gridFiles.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _gridFiles.CanFocus            = true;

            _scrollPane = new ScrollPane();
            _scrollPane.AllowHorizontalScrolling = false;
            _scrollPane.Id = "_scrollPane";
            _scrollPane.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _scrollPane.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _scrollPane.GridPositionX       = 2;
            _scrollPane.ClipToBounds        = true;
            _scrollPane.CanFocus            = true;
            _scrollPane.Child = _gridFiles;

            _splitPane    = new HorizontalSplitPane();
            _splitPane.Id = "_splitPane";
            _splitPane.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _splitPane.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _splitPane.GridPositionY       = 1;
            _splitPane.Widgets.Add(_listBoxPlaces);
            _splitPane.Widgets.Add(_scrollPane);

            _textBlockFileName      = new TextBlock();
            _textBlockFileName.Text = "File name";
            _textBlockFileName.Id   = "_textBlockFileName";

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

            var grid2 = new Grid();

            grid2.DrawLinesColor = Color.White;
            grid2.ColumnSpacing  = 4;
            grid2.ColumnsProportions.Add(new Grid.Proportion());
            grid2.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid2.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid2.GridPositionY       = 2;
            grid2.Widgets.Add(_textBlockFileName);
            grid2.Widgets.Add(_textFieldFileName);

            var grid3 = new Grid();

            grid3.DrawLinesColor = Color.White;
            grid3.RowSpacing     = 4;
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid3.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid3.GridPositionY       = 1;
            grid3.Widgets.Add(grid1);
            grid3.Widgets.Add(_splitPane);
            grid3.Widgets.Add(grid2);


            Title          = "Open File...";
            TitleTextColor = Color.White;
            DrawLinesColor = Color.White;
            XHint          = 141;
            YHint          = 183;
            WidthHint      = 600;
            HeightHint     = 400;
            PaddingLeft    = 5;
            PaddingRight   = 5;
            PaddingTop     = 5;
            PaddingBottom  = 5;
            CanFocus       = true;
            Content        = grid3;
        }
Ejemplo n.º 14
0
        private void BuildUI()
        {
            _menuItemNew      = new MenuItem();
            _menuItemNew.Id   = "_menuItemNew";
            _menuItemNew.Text = "&New";

            _menuItemOpen      = new MenuItem();
            _menuItemOpen.Id   = "_menuItemOpen";
            _menuItemOpen.Text = "&Open";

            _menuItemSave      = new MenuItem();
            _menuItemSave.Id   = "_menuItemSave";
            _menuItemSave.Text = "&Save";

            _menuItemSaveAs      = new MenuItem();
            _menuItemSaveAs.Id   = "_menuItemSaveAs";
            _menuItemSaveAs.Text = "Save &As...";

            var menuSeparator1 = new MenuSeparator();

            _menuItemQuit      = new MenuItem();
            _menuItemQuit.Id   = "_menuItemQuit";
            _menuItemQuit.Text = "&Quit";

            var menuItem1 = new MenuItem();

            menuItem1.Id   = "";
            menuItem1.Text = "&File";
            menuItem1.Items.Add(_menuItemNew);
            menuItem1.Items.Add(_menuItemOpen);
            menuItem1.Items.Add(_menuItemSave);
            menuItem1.Items.Add(_menuItemSaveAs);
            menuItem1.Items.Add(menuSeparator1);
            menuItem1.Items.Add(_menuItemQuit);

            _menuItemCopy      = new MenuItem();
            _menuItemCopy.Id   = "_menuItemCopy";
            _menuItemCopy.Text = "&Copy";

            _menuItemPaste      = new MenuItem();
            _menuItemPaste.Id   = "_menuItemPaste";
            _menuItemPaste.Text = "&Paste";

            var menuSeparator2 = new MenuSeparator();

            _menuItemUndo      = new MenuItem();
            _menuItemUndo.Id   = "_menuItemUndo";
            _menuItemUndo.Text = "&Undo";

            _menuItemRedo      = new MenuItem();
            _menuItemRedo.Id   = "_menuItemRedo";
            _menuItemRedo.Text = "&Redo";

            var menuItem2 = new MenuItem();

            menuItem2.Id   = "";
            menuItem2.Text = "&Edit";
            menuItem2.Items.Add(_menuItemCopy);
            menuItem2.Items.Add(_menuItemPaste);
            menuItem2.Items.Add(menuSeparator2);
            menuItem2.Items.Add(_menuItemUndo);
            menuItem2.Items.Add(_menuItemRedo);

            _menuItemAbout      = new MenuItem();
            _menuItemAbout.Id   = "_menuItemAbout";
            _menuItemAbout.Text = "&About";

            var menuItem3 = new MenuItem();

            menuItem3.Id   = "";
            menuItem3.Text = "&Help";
            menuItem3.Items.Add(_menuItemAbout);

            var horizontalMenu1 = new HorizontalMenu();

            horizontalMenu1.DrawLinesColor      = Color.White;
            horizontalMenu1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            horizontalMenu1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            horizontalMenu1.Items.Add(menuItem1);
            horizontalMenu1.Items.Add(menuItem2);
            horizontalMenu1.Items.Add(menuItem3);

            var textBlock1 = new TextBlock();

            textBlock1.Text              = "Button:";
            textBlock1.TextColor         = Color.White;
            textBlock1.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock1.Id = "";

            _button                            = new Button();
            _button.Text                       = "Show Window";
            _button.TextColor                  = Color.White;
            _button.ImageTextSpacing           = 8;
            _button.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _button.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _button.Id                         = "_button";
            _button.PaddingLeft                = 8;
            _button.PaddingRight               = 8;
            _button.GridPositionX              = 1;

            var textBlock2 = new TextBlock();

            textBlock2.Text              = "Blue Button:";
            textBlock2.TextColor         = Color.White;
            textBlock2.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock2.Id            = "";
            textBlock2.GridPositionY = 1;

            _blueButton                            = new Button("blue");
            _blueButton.Text                       = "Show Window";
            _blueButton.TextColor                  = Color.White;
            _blueButton.ImageTextSpacing           = 8;
            _blueButton.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _blueButton.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _blueButton.Id                         = "_blueButton";
            _blueButton.PaddingLeft                = 8;
            _blueButton.PaddingRight               = 8;
            _blueButton.GridPositionX              = 1;
            _blueButton.GridPositionY              = 1;

            var textBlock3 = new TextBlock();

            textBlock3.Text              = "Text Button:";
            textBlock3.TextColor         = Color.White;
            textBlock3.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock3.Id            = "";
            textBlock3.GridPositionY = 2;

            _textButton           = new TextButton();
            _textButton.Text      = "Show Window";
            _textButton.TextColor = Color.White;
            _textButton.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _textButton.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _textButton.Id            = "_textButton";
            _textButton.PaddingLeft   = 8;
            _textButton.PaddingRight  = 8;
            _textButton.GridPositionX = 1;
            _textButton.GridPositionY = 2;

            var textBlock4 = new TextBlock();

            textBlock4.Text              = "Image Button:";
            textBlock4.TextColor         = Color.White;
            textBlock4.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock4.Id            = "";
            textBlock4.GridPositionY = 3;

            _imageButton = new ImageButton();
            _imageButton.ImageVisible = true;
            _imageButton.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _imageButton.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _imageButton.Id            = "_imageButton";
            _imageButton.PaddingLeft   = 8;
            _imageButton.PaddingRight  = 8;
            _imageButton.GridPositionX = 1;
            _imageButton.GridPositionY = 3;

            var checkBox1 = new CheckBox();

            checkBox1.Text                       = "This is checkbox";
            checkBox1.TextColor                  = Color.White;
            checkBox1.ImageWidthHint             = 10;
            checkBox1.ImageHeightHint            = 10;
            checkBox1.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            checkBox1.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            checkBox1.GridPositionY              = 4;
            checkBox1.GridSpanX                  = 2;

            var textBlock5 = new TextBlock();

            textBlock5.Text              = "Horizontal Slider:";
            textBlock5.TextColor         = Color.White;
            textBlock5.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock5.Id            = "";
            textBlock5.GridPositionY = 5;

            var horizontalSlider1 = new HorizontalSlider();

            horizontalSlider1.Maximum             = 100;
            horizontalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            horizontalSlider1.GridPositionX       = 1;
            horizontalSlider1.GridPositionY       = 5;

            var textBlock6 = new TextBlock();

            textBlock6.Text              = "Combo Box:";
            textBlock6.TextColor         = Color.White;
            textBlock6.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock6.GridPositionY = 6;

            var listItem1 = new ListItem();

            listItem1.Id    = "";
            listItem1.Text  = "Red";
            listItem1.Color = Color.Red;

            var listItem2 = new ListItem();

            listItem2.Text  = "Green";
            listItem2.Color = Color.Lime;

            var listItem3 = new ListItem();

            listItem3.Text  = "Blue";
            listItem3.Color = new Color
            {
                B           = 255,
                G           = 128,
                A           = 255,
                PackedValue = 4294934528,
            };

            var comboBox1 = new ComboBox();

            comboBox1.WidthHint     = 200;
            comboBox1.GridPositionX = 1;
            comboBox1.GridPositionY = 6;
            comboBox1.Items.Add(listItem1);
            comboBox1.Items.Add(listItem2);
            comboBox1.Items.Add(listItem3);

            var textBlock7 = new TextBlock();

            textBlock7.Text              = "Text Field:";
            textBlock7.TextColor         = Color.White;
            textBlock7.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock7.GridPositionY = 7;

            var textField1 = new TextField();

            textField1.Text              = "";
            textField1.TextColor         = Color.White;
            textField1.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textField1.MessageTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textField1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            textField1.GridPositionX       = 1;
            textField1.GridPositionY       = 7;
            textField1.CanFocus            = true;

            var textBlock8 = new TextBlock();

            textBlock8.Text              = "Spin Button:";
            textBlock8.TextColor         = Color.White;
            textBlock8.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock8.GridPositionY = 8;

            var spinButton1 = new SpinButton();

            spinButton1.Value          = 0;
            spinButton1.DrawLinesColor = Color.White;
            spinButton1.WidthHint      = 100;
            spinButton1.GridPositionX  = 1;
            spinButton1.GridPositionY  = 8;

            var textBlock9 = new TextBlock();

            textBlock9.Text              = "List Box:";
            textBlock9.TextColor         = Color.White;
            textBlock9.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock9.GridPositionY = 9;

            var listItem4 = new ListItem();

            listItem4.Text  = "Red";
            listItem4.Color = Color.Red;

            var listItem5 = new ListItem();

            listItem5.Text  = "Green";
            listItem5.Color = Color.Lime;

            var listItem6 = new ListItem();

            listItem6.Text  = "Blue";
            listItem6.Color = Color.Blue;

            var listBox1 = new ListBox();

            listBox1.DrawLinesColor      = Color.White;
            listBox1.WidthHint           = 200;
            listBox1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            listBox1.GridPositionX       = 1;
            listBox1.GridPositionY       = 9;
            listBox1.Items.Add(listItem4);
            listBox1.Items.Add(listItem5);
            listBox1.Items.Add(listItem6);

            var textBlock10 = new TextBlock();

            textBlock10.Text              = "Vertical Menu:";
            textBlock10.TextColor         = Color.White;
            textBlock10.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock10.GridPositionY = 10;

            var menuItem4 = new MenuItem();

            menuItem4.Id   = "";
            menuItem4.Text = "Start New Game";

            var menuItem5 = new MenuItem();

            menuItem5.Id   = "";
            menuItem5.Text = "Options";

            var menuItem6 = new MenuItem();

            menuItem6.Id   = "";
            menuItem6.Text = "Quit";

            var verticalMenu1 = new VerticalMenu();

            verticalMenu1.DrawLinesColor    = Color.White;
            verticalMenu1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            verticalMenu1.GridPositionX     = 1;
            verticalMenu1.GridPositionY     = 10;
            verticalMenu1.Items.Add(menuItem4);
            verticalMenu1.Items.Add(menuItem5);
            verticalMenu1.Items.Add(menuItem6);

            var textBlock11 = new TextBlock();

            textBlock11.Text              = "Tree";
            textBlock11.TextColor         = Color.White;
            textBlock11.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textBlock11.GridPositionY = 11;

            _gridRight = new Grid();
            _gridRight.DrawLinesColor = Color.White;
            _gridRight.ColumnSpacing  = 8;
            _gridRight.RowSpacing     = 8;
            _gridRight.ColumnsProportions.Add(new Proportion());
            _gridRight.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.RowsProportions.Add(new Proportion());
            _gridRight.Id = "_gridRight";
            _gridRight.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _gridRight.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _gridRight.Widgets.Add(textBlock1);
            _gridRight.Widgets.Add(_button);
            _gridRight.Widgets.Add(textBlock2);
            _gridRight.Widgets.Add(_blueButton);
            _gridRight.Widgets.Add(textBlock3);
            _gridRight.Widgets.Add(_textButton);
            _gridRight.Widgets.Add(textBlock4);
            _gridRight.Widgets.Add(_imageButton);
            _gridRight.Widgets.Add(checkBox1);
            _gridRight.Widgets.Add(textBlock5);
            _gridRight.Widgets.Add(horizontalSlider1);
            _gridRight.Widgets.Add(textBlock6);
            _gridRight.Widgets.Add(comboBox1);
            _gridRight.Widgets.Add(textBlock7);
            _gridRight.Widgets.Add(textField1);
            _gridRight.Widgets.Add(textBlock8);
            _gridRight.Widgets.Add(spinButton1);
            _gridRight.Widgets.Add(textBlock9);
            _gridRight.Widgets.Add(listBox1);
            _gridRight.Widgets.Add(textBlock10);
            _gridRight.Widgets.Add(verticalMenu1);
            _gridRight.Widgets.Add(textBlock11);

            var scrollPane1 = new ScrollPane();

            scrollPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            scrollPane1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            scrollPane1.ClipToBounds        = true;
            scrollPane1.CanFocus            = true;
            scrollPane1.Child = _gridRight;

            var textBlock12 = new TextBlock();

            textBlock12.Text              = "Vertical Slider:";
            textBlock12.TextColor         = Color.White;
            textBlock12.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };

            var verticalSlider1 = new VerticalSlider();

            verticalSlider1.Maximum             = 100;
            verticalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            verticalSlider1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            verticalSlider1.GridPositionY       = 1;

            var grid1 = new Grid();

            grid1.DrawLinesColor = Color.White;
            grid1.RowSpacing     = 8;
            grid1.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.RowsProportions.Add(new Proportion());
            grid1.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid1.Widgets.Add(textBlock12);
            grid1.Widgets.Add(verticalSlider1);

            var textBlock13 = new TextBlock();

            textBlock13.Text              = "Progress Bars:";
            textBlock13.TextColor         = Color.White;
            textBlock13.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };

            _horizontalProgressBar                     = new HorizontalProgressBar();
            _horizontalProgressBar.Maximum             = 100;
            _horizontalProgressBar.DrawLinesColor      = Color.White;
            _horizontalProgressBar.Id                  = "_horizontalProgressBar";
            _horizontalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _horizontalProgressBar.GridPositionY       = 1;

            _verticalProgressBar                     = new VerticalProgressBar();
            _verticalProgressBar.Maximum             = 100;
            _verticalProgressBar.DrawLinesColor      = Color.White;
            _verticalProgressBar.Id                  = "_verticalProgressBar";
            _verticalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _verticalProgressBar.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _verticalProgressBar.GridPositionY       = 2;

            var grid2 = new Grid();

            grid2.DrawLinesColor = Color.White;
            grid2.RowSpacing     = 8;
            grid2.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.RowsProportions.Add(new Proportion());
            grid2.RowsProportions.Add(new Proportion());
            grid2.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid2.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid2.GridPositionY       = 2;
            grid2.Widgets.Add(textBlock13);
            grid2.Widgets.Add(_horizontalProgressBar);
            grid2.Widgets.Add(_verticalProgressBar);

            var verticalSplitPane1 = new VerticalSplitPane();

            verticalSplitPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            verticalSplitPane1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            verticalSplitPane1.GridPositionX       = 2;
            verticalSplitPane1.Widgets.Add(grid1);
            verticalSplitPane1.Widgets.Add(grid2);

            var horizontalSplitPane1 = new HorizontalSplitPane();

            horizontalSplitPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            horizontalSplitPane1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            horizontalSplitPane1.GridPositionY       = 1;
            horizontalSplitPane1.Widgets.Add(scrollPane1);
            horizontalSplitPane1.Widgets.Add(verticalSplitPane1);


            DrawLinesColor = Color.White;
            RowSpacing     = 8;
            RowsProportions.Add(new Proportion());
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            Id = "Root";
            HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            Widgets.Add(horizontalMenu1);
            Widgets.Add(horizontalSplitPane1);
        }
Ejemplo n.º 15
0
        private void BuildUI()
        {
            menuItemNew      = new MenuItem();
            menuItemNew.Id   = "menuItemNew";
            menuItemNew.Text = "New";

            menuItemOpen      = new MenuItem();
            menuItemOpen.Id   = "menuItemOpen";
            menuItemOpen.Text = "Open...";

            menuItemSave      = new MenuItem();
            menuItemSave.Id   = "menuItemSave";
            menuItemSave.Text = "Save";

            menuItemSaveAs      = new MenuItem();
            menuItemSaveAs.Id   = "menuItemSaveAs";
            menuItemSaveAs.Text = "Save As...";

            var menuSeparator1 = new MenuSeparator();

            menuItemQuit      = new MenuItem();
            menuItemQuit.Id   = "menuItemQuit";
            menuItemQuit.Text = "Quit";

            menuItemFile      = new MenuItem();
            menuItemFile.Id   = "menuItemFile";
            menuItemFile.Text = "File";
            menuItemFile.Items.Add(menuItemNew);
            menuItemFile.Items.Add(menuItemOpen);
            menuItemFile.Items.Add(menuItemSave);
            menuItemFile.Items.Add(menuItemSaveAs);
            menuItemFile.Items.Add(menuSeparator1);
            menuItemFile.Items.Add(menuItemQuit);

            menuItemAbout      = new MenuItem();
            menuItemAbout.Id   = "menuItemAbout";
            menuItemAbout.Text = "About";

            menuItemHelp      = new MenuItem();
            menuItemHelp.Id   = "menuItemHelp";
            menuItemHelp.Text = "Help";
            menuItemHelp.Items.Add(menuItemAbout);

            mainMenu = new HorizontalMenu();
            mainMenu.DrawLinesColor      = Color.White;
            mainMenu.Id                  = "mainMenu";
            mainMenu.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            mainMenu.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            mainMenu.Items.Add(menuItemFile);
            mainMenu.Items.Add(menuItemHelp);

            textArea                     = new TextField();
            textArea.Text                = "";
            textArea.Multiline           = true;
            textArea.Id                  = "textArea";
            textArea.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            textArea.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            textArea.CanFocus            = true;

            var scrollPane1 = new ScrollPane();

            scrollPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            scrollPane1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            scrollPane1.GridPositionY       = 1;
            scrollPane1.ClipToBounds        = true;
            scrollPane1.CanFocus            = true;
            scrollPane1.Child = textArea;


            DrawLinesColor = Color.White;
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            Id = "Root";
            HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            Widgets.Add(mainMenu);
            Widgets.Add(scrollPane1);
        }
Ejemplo n.º 16
0
        protected override void InitializeCore()
        {
            ShowDebug = true;

            //Debugger.Launch();

            _spriteBatch = new GdxSpriteBatch(Context.GraphicsDevice);
            _skin        = new Skin(Context.GraphicsDevice, "Data/uiskin.json");
            _texture1    = new TextureContext(Context.GraphicsDevice, "Data/badlogicsmall.jpg", true);
            _texture2    = new TextureContext(Context.GraphicsDevice, "Data/badlogic.jpg", true);

            TextureRegion image        = new TextureRegion(_texture1);
            TextureRegion imageFlipped = new TextureRegion(image);

            imageFlipped.Flip(true, true);
            TextureRegion image2 = new TextureRegion(_texture2);

            _stage = new Stage(Context.GraphicsDevice.Viewport.Width, Context.GraphicsDevice.Viewport.Height, true, Context.GraphicsDevice);

            Context.Input.Processor = _stage;

            ImageButtonStyle style = new ImageButtonStyle(_skin.Get <ButtonStyle>())
            {
                ImageUp   = new TextureRegionDrawable(image),
                ImageDown = new TextureRegionDrawable(imageFlipped),
            };
            ImageButton iconButton = new ImageButton(style);

            Button buttonMulti = new TextButton("Multi\nLine\nToggle", _skin, "toggle")
            {
                IsToggle = true,
            };
            Button imgButton       = new Button(new Image(image), _skin);
            Button imgToggleButton = new Button(new Image(image), _skin, "toggle")
            {
                IsToggle = true,
            };

            Label myLabel = new Label("This is some text.", _skin);

            myLabel.TextWrapping = true;

            Table t = new Table();

            t.Row();
            t.Add(myLabel);

            t.Layout();

            CheckBox  checkbox  = new CheckBox("Check me", _skin);
            Slider    slider    = new Slider(0, 10, 1, false, _skin);
            TextField textField = new TextField("", _skin)
            {
                MessageText = "Click here!",
            };
            SelectBox  dropdown   = new SelectBox(selectEntries, _skin);
            Image      imageActor = new Image(image2);
            ScrollPane scrollPane = new ScrollPane(imageActor);

            MonoGdx.Scene2D.UI.List list = new MonoGdx.Scene2D.UI.List(listEntries, _skin);
            ScrollPane scrollPane2       = new ScrollPane(list, _skin);
            //scrollPane2.FlickScroll = false;
            SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false, _skin, "default-horizontal");

            _fpsLabel = new Label("fps:", _skin);

            Label     passwordLabel = new Label("Textfield in password mode: ", _skin);
            TextField passwordField = new TextField("", _skin)
            {
                MessageText       = "password",
                PasswordCharacter = '*',
                IsPasswordMode    = true,
            };

            Window window = new Window("Dialog", _skin);

            window.SetPosition(0, 0);
            window.Defaults().SpaceBottom = 10;
            window.Row().Configure.Fill().ExpandX();
            window.Add(iconButton);
            window.Add(buttonMulti);
            window.Add(imgButton);
            window.Add(imgToggleButton);
            window.Row();
            window.Add(checkbox);
            window.Add(slider).Configure.MinWidth(100).FillX().Colspan(3);
            window.Row();
            window.Add(dropdown).Configure.MinWidth(100).FillX();
            window.Add(textField).Configure.MinWidth(100).ExpandX().FillX().Colspan(3);
            window.Row();
            window.Add(splitPane).Configure.Fill().Expand().Colspan(4).MaxHeight(200);
            window.Row();
            window.Add(passwordLabel).Configure.Colspan(2);
            window.Add(passwordField).Configure.MinWidth(100).ExpandX().FillX().Colspan(2);

            window.Pack();

            /*textField.KeyUp += (field, c) => {
             *  if (c == '\n')
             *      field.OnscreenKeyboard.Show(false);
             * };*/

            _stage.AddActor(window);

            MonoGdx.Scene2D.UI.List list2 = new MonoGdx.Scene2D.UI.List(listEntries, _skin);
            ScrollPane scrollPane22       = new ScrollPane(list2, _skin);
            Window     window2            = new Window("ScrollPane", _skin);

            window2.SetPosition(300, 300);
            window2.Defaults().SpaceBottom = 10;
            window2.Row().Configure.Fill().ExpandX();
            window2.Add(scrollPane22).Configure.MaxHeight(250).MaxWidth(150);
            window2.Pack();

            _stage.AddActor(window2);
        }
Ejemplo n.º 17
0
        private void BuildUI()
        {
            menuItemNew      = new MenuItem();
            menuItemNew.Id   = "menuItemNew";
            menuItemNew.Text = "New";

            menuItemOpen      = new MenuItem();
            menuItemOpen.Id   = "menuItemOpen";
            menuItemOpen.Text = "Open...";

            menuItemSave      = new MenuItem();
            menuItemSave.Id   = "menuItemSave";
            menuItemSave.Text = "Save";

            menuItemSaveAs      = new MenuItem();
            menuItemSaveAs.Id   = "menuItemSaveAs";
            menuItemSaveAs.Text = "Save As...";

            var menuSeparator1 = new MenuSeparator();

            menuItemDebugOptions      = new MenuItem();
            menuItemDebugOptions.Id   = "menuItemDebugOptions";
            menuItemDebugOptions.Text = "Debug Options";

            var menuSeparator2 = new MenuSeparator();

            menuItemQuit      = new MenuItem();
            menuItemQuit.Id   = "menuItemQuit";
            menuItemQuit.Text = "Quit";

            menuItemFile      = new MenuItem();
            menuItemFile.Id   = "menuItemFile";
            menuItemFile.Text = "File";
            menuItemFile.Items.Add(menuItemNew);
            menuItemFile.Items.Add(menuItemOpen);
            menuItemFile.Items.Add(menuItemSave);
            menuItemFile.Items.Add(menuItemSaveAs);
            menuItemFile.Items.Add(menuSeparator1);
            menuItemFile.Items.Add(menuItemDebugOptions);
            menuItemFile.Items.Add(menuSeparator2);
            menuItemFile.Items.Add(menuItemQuit);

            menuItemAbout      = new MenuItem();
            menuItemAbout.Id   = "menuItemAbout";
            menuItemAbout.Text = "About";

            menuItemHelp      = new MenuItem();
            menuItemHelp.Id   = "menuItemHelp";
            menuItemHelp.Text = "Help";
            menuItemHelp.Items.Add(menuItemAbout);

            mainMenu = new HorizontalMenu();
            mainMenu.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            mainMenu.Id = "mainMenu";
            mainMenu.Items.Add(menuItemFile);
            mainMenu.Items.Add(menuItemHelp);

            var horizontalSeparator1 = new HorizontalSeparator();

            horizontalSeparator1.GridRow = 1;

            textArea                   = new TextField();
            textArea.Text              = "";
            textArea.Multiline         = true;
            textArea.Wrap              = true;
            textArea.Id                = "textArea";
            textArea.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch;

            var scrollPane1 = new ScrollPane();

            scrollPane1.GridRow = 2;
            scrollPane1.Content = textArea;

            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            Id = "Root";
            Widgets.Add(mainMenu);
            Widgets.Add(horizontalSeparator1);
            Widgets.Add(scrollPane1);
        }
Ejemplo n.º 18
0
        public void TestScrollPane()
        {
            ScrollPane pane = new ScrollPane("newPane");

            Assert.AreEqual("newPane", pane.Name);
            Assert.AreEqual(String.Empty, pane.Text);
            Assert.IsTrue(pane is Component);

            ScrollPane anotherPane = new ScrollPane("anotherPane", "someText");
            Assert.AreEqual("someText", anotherPane.Text);
            Assert.AreEqual("anotherPane", anotherPane.Name);

            Assert.AreEqual("scrollPane", anotherPane.Type);
            Assert.AreEqual("scrollPane(\"anotherPane\")", anotherPane.GetBaseComponentString());
            Assert.AreEqual("getTestFixture().scrollPane(\"anotherPane\")", anotherPane.GetQueryString());
            Assert.AreEqual("getTestFixture().prefix(\"prefix\").scrollPane(\"anotherPane\")", anotherPane.GetQueryString("prefix(\"prefix\")"));
        }
Ejemplo n.º 19
0
        protected override void InitializeCore()
        {
            //Debugger.Launch();
            _stage = new Stage(Context.Window.ClientBounds.Width, Context.Window.ClientBounds.Height, true, Context.GraphicsDevice);
            Skin skin = new Skin(Context.GraphicsDevice, "Data/uiskin.json");

            Context.Input.Processor = _stage;

            _container = new Table();
            _stage.AddActor(_container);
            _container.SetFillParent(true);

            Table table = new Table();

            ScrollPane scroll = new ScrollPane(table, skin);

            /*InputListener stopTouchDown = new DispatchInputListener() {
             *  OnTouchDown = (ev, x, y, pointer, button) => {
             *      ev.Stop();
             *      return false;
             *  },
             * };*/

            table.Pad(10);
            table.Defaults().Configure.ExpandX().Space(4);

            for (int i = 0; i < 100; i++)
            {
                table.Row();
                Cell rowCell = table.Add(new Label(i + "uno", skin));
                rowCell.ExpandX = 1;
                rowCell.FillX   = 1;

                TextButton button = new TextButton(i + "dos", skin);
                table.Add(button);
                button.Clicked += (a, e) => {
                    Console.WriteLine("Clicked");
                };

                Slider slider = new Slider(0, 100, 1, false, skin);
                slider.TouchDown += (s, e) => { e.Stopped = true; };
                table.Add(slider);

                table.Add(new Label(i + "tres long0 long1 long2 long3 long4 long5 long6 long7 long8 long9 long10 long11 long12", skin));
            }

            TextButton flickButton = new TextButton("Flick Scroll", skin.Get <TextButtonStyle>("toggle"))
            {
                IsToggle  = true,
                IsChecked = false,
            };

            flickButton.Checked   += (sender, e) => { scroll.FlickScroll = true; };
            flickButton.Unchecked += (sender, e) => { scroll.FlickScroll = false; };

            TextButton fadeButton = new TextButton("Fade Scrollbars", skin.Get <TextButtonStyle>("toggle"))
            {
                IsToggle  = true,
                IsChecked = false,
            };

            fadeButton.Checked   += (sender, e) => { scroll.FadeScrollBars = true; };
            fadeButton.Unchecked += (sender, e) => { scroll.FadeScrollBars = false; };

            TextButton smoothButton = new TextButton("Smooth Scrolling", skin.Get <TextButtonStyle>("toggle"))
            {
                IsToggle  = true,
                IsChecked = false,
            };

            smoothButton.Checked   += (sender, e) => { scroll.SmoothScrolling = true; };
            smoothButton.Unchecked += (sender, e) => { scroll.SmoothScrolling = false; };

            TextButton onTopButton = new TextButton("Scrollbars On Top", skin.Get <TextButtonStyle>("toggle"))
            {
                IsToggle  = true,
                IsChecked = false,
            };

            onTopButton.Checked   += (sender, e) => { scroll.ScrollBarsOnTop = true; };
            onTopButton.Unchecked += (sender, e) => { scroll.ScrollBarsOnTop = false; };

            _container.Add(scroll).Configure.Expand().Fill().Colspan(4);
            _container.Row().Configure.Space(10).PadBottom(10);
            _container.Add(flickButton).Configure.Right().ExpandX();
            _container.Add(onTopButton);
            _container.Add(smoothButton);
            _container.Add(fadeButton).Configure.Left().ExpandX();
        }
Ejemplo n.º 20
0
        private void BuildUI()
        {
            var textBlock1 = new TextBlock();

            textBlock1.Text = "Button:";
            textBlock1.Id   = "";

            _button              = new ImageTextButton();
            _button.Text         = "Button";
            _button.Id           = "_button";
            _button.PaddingLeft  = 8;
            _button.PaddingRight = 8;
            _button.GridColumn   = 1;

            _textButtonLabel         = new TextBlock();
            _textButtonLabel.Text    = "Text Button:";
            _textButtonLabel.Id      = "_textButtonLabel";
            _textButtonLabel.GridRow = 1;

            _textButton              = new TextButton();
            _textButton.Text         = "Choose Color";
            _textButton.Id           = "_textButton";
            _textButton.PaddingLeft  = 8;
            _textButton.PaddingRight = 8;
            _textButton.GridColumn   = 1;
            _textButton.GridRow      = 1;

            var textBlock2 = new TextBlock();

            textBlock2.Text    = "Image Button:";
            textBlock2.Id      = "";
            textBlock2.GridRow = 2;

            _imageButton              = new ImageButton();
            _imageButton.Id           = "_imageButton";
            _imageButton.PaddingLeft  = 8;
            _imageButton.PaddingRight = 8;
            _imageButton.GridColumn   = 1;
            _imageButton.GridRow      = 2;

            var checkBox1 = new CheckBox();

            checkBox1.Text           = "This is checkbox";
            checkBox1.ImageWidth     = 10;
            checkBox1.ImageHeight    = 10;
            checkBox1.GridRow        = 3;
            checkBox1.GridColumnSpan = 2;

            var textBlock3 = new TextBlock();

            textBlock3.Text    = "Horizontal Slider:";
            textBlock3.Id      = "";
            textBlock3.GridRow = 4;

            var horizontalSlider1 = new HorizontalSlider();

            horizontalSlider1.GridColumn = 1;
            horizontalSlider1.GridRow    = 4;

            var textBlock4 = new TextBlock();

            textBlock4.Text    = "Combo Box:";
            textBlock4.GridRow = 5;

            var listItem1 = new ListItem();

            listItem1.Id    = "";
            listItem1.Text  = "Red";
            listItem1.Color = Color.Red;

            var listItem2 = new ListItem();

            listItem2.Id    = null;
            listItem2.Text  = "Green";
            listItem2.Color = Color.Lime;

            var listItem3 = new ListItem();

            listItem3.Id    = null;
            listItem3.Text  = "Blue";
            listItem3.Color = new Color
            {
                B = 255,
                G = 128,
                R = 0,
                A = 255,
            };

            var comboBox1 = new ComboBox();

            comboBox1.Width      = 200;
            comboBox1.GridColumn = 1;
            comboBox1.GridRow    = 5;
            comboBox1.Items.Add(listItem1);
            comboBox1.Items.Add(listItem2);
            comboBox1.Items.Add(listItem3);

            var textBlock5 = new TextBlock();

            textBlock5.Text    = "Text Field:";
            textBlock5.GridRow = 6;

            var textField1 = new TextField();

            textField1.Text       = "";
            textField1.GridColumn = 1;
            textField1.GridRow    = 6;

            var textBlock6 = new TextBlock();

            textBlock6.Text    = "List Box:";
            textBlock6.GridRow = 7;

            var listItem4 = new ListItem();

            listItem4.Id    = null;
            listItem4.Text  = "Red";
            listItem4.Color = Color.Red;

            var listItem5 = new ListItem();

            listItem5.Id    = null;
            listItem5.Text  = "Green";
            listItem5.Color = Color.Lime;

            var listItem6 = new ListItem();

            listItem6.Id    = null;
            listItem6.Text  = "Blue";
            listItem6.Color = Color.Blue;

            var listBox1 = new ListBox();

            listBox1.Width      = 200;
            listBox1.GridColumn = 1;
            listBox1.GridRow    = 7;
            listBox1.Items.Add(listItem4);
            listBox1.Items.Add(listItem5);
            listBox1.Items.Add(listItem6);

            var textBlock7 = new TextBlock();

            textBlock7.Text    = "Tree";
            textBlock7.GridRow = 8;

            _gridRight = new Grid();
            _gridRight.ColumnSpacing = 8;
            _gridRight.RowSpacing    = 8;
            _gridRight.ColumnsProportions.Add(new Grid.Proportion());
            _gridRight.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.Id = "_gridRight";
            _gridRight.Widgets.Add(textBlock1);
            _gridRight.Widgets.Add(_button);
            _gridRight.Widgets.Add(_textButtonLabel);
            _gridRight.Widgets.Add(_textButton);
            _gridRight.Widgets.Add(textBlock2);
            _gridRight.Widgets.Add(_imageButton);
            _gridRight.Widgets.Add(checkBox1);
            _gridRight.Widgets.Add(textBlock3);
            _gridRight.Widgets.Add(horizontalSlider1);
            _gridRight.Widgets.Add(textBlock4);
            _gridRight.Widgets.Add(comboBox1);
            _gridRight.Widgets.Add(textBlock5);
            _gridRight.Widgets.Add(textField1);
            _gridRight.Widgets.Add(textBlock6);
            _gridRight.Widgets.Add(listBox1);
            _gridRight.Widgets.Add(textBlock7);

            var scrollPane1 = new ScrollPane();

            scrollPane1.Content = _gridRight;

            var textBlock8 = new TextBlock();

            textBlock8.Text = "Vertical Slider:";

            var verticalSlider1 = new VerticalSlider();

            verticalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            verticalSlider1.GridRow             = 1;

            var grid1 = new Grid();

            grid1.RowSpacing = 8;
            grid1.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.Widgets.Add(textBlock8);
            grid1.Widgets.Add(verticalSlider1);

            var textBlock9 = new TextBlock();

            textBlock9.Text = "Progress Bars:";

            _horizontalProgressBar         = new HorizontalProgressBar();
            _horizontalProgressBar.Id      = "_horizontalProgressBar";
            _horizontalProgressBar.GridRow = 1;

            _verticalProgressBar = new VerticalProgressBar();
            _verticalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _verticalProgressBar.Id      = "_verticalProgressBar";
            _verticalProgressBar.GridRow = 2;

            var grid2 = new Grid();

            grid2.RowSpacing = 8;
            grid2.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.GridRow = 2;
            grid2.Widgets.Add(textBlock9);
            grid2.Widgets.Add(_horizontalProgressBar);
            grid2.Widgets.Add(_verticalProgressBar);

            var verticalSplitPane1 = new VerticalSplitPane();

            verticalSplitPane1.GridColumn = 2;
            verticalSplitPane1.Widgets.Add(grid1);
            verticalSplitPane1.Widgets.Add(grid2);


            GridRow = 1;
            Widgets.Add(scrollPane1);
            Widgets.Add(verticalSplitPane1);
        }
Ejemplo n.º 21
0
        private void BuildUI()
        {
            _menuItemNew      = new MenuItem();
            _menuItemNew.Id   = "_menuItemNew";
            _menuItemNew.Text = "&New";

            _menuItemOpen      = new MenuItem();
            _menuItemOpen.Id   = "_menuItemOpen";
            _menuItemOpen.Text = "&Open";

            _menuItemSave      = new MenuItem();
            _menuItemSave.Id   = "_menuItemSave";
            _menuItemSave.Text = "&Save";

            _menuItemSaveAs      = new MenuItem();
            _menuItemSaveAs.Id   = "_menuItemSaveAs";
            _menuItemSaveAs.Text = "Save &As...";

            var menuSeparator1 = new MenuSeparator();

            _menuItemQuit      = new MenuItem();
            _menuItemQuit.Id   = "_menuItemQuit";
            _menuItemQuit.Text = "&Quit";

            var menuItem1 = new MenuItem();

            menuItem1.Id   = "";
            menuItem1.Text = "&File";
            menuItem1.Items.Add(_menuItemNew);
            menuItem1.Items.Add(_menuItemOpen);
            menuItem1.Items.Add(_menuItemSave);
            menuItem1.Items.Add(_menuItemSaveAs);
            menuItem1.Items.Add(menuSeparator1);
            menuItem1.Items.Add(_menuItemQuit);

            _menuItemCopy      = new MenuItem();
            _menuItemCopy.Id   = "_menuItemCopy";
            _menuItemCopy.Text = "&Copy";

            _menuItemPaste      = new MenuItem();
            _menuItemPaste.Id   = "_menuItemPaste";
            _menuItemPaste.Text = "&Paste";

            var menuSeparator2 = new MenuSeparator();

            _menuItemUndo      = new MenuItem();
            _menuItemUndo.Id   = "_menuItemUndo";
            _menuItemUndo.Text = "&Undo";

            _menuItemRedo      = new MenuItem();
            _menuItemRedo.Id   = "_menuItemRedo";
            _menuItemRedo.Text = "&Redo";

            var menuItem2 = new MenuItem();

            menuItem2.Id   = "";
            menuItem2.Text = "&Edit";
            menuItem2.Items.Add(_menuItemCopy);
            menuItem2.Items.Add(_menuItemPaste);
            menuItem2.Items.Add(menuSeparator2);
            menuItem2.Items.Add(_menuItemUndo);
            menuItem2.Items.Add(_menuItemRedo);

            _menuItemAbout      = new MenuItem();
            _menuItemAbout.Id   = "_menuItemAbout";
            _menuItemAbout.Text = "&About";

            var menuItem3 = new MenuItem();

            menuItem3.Id   = "";
            menuItem3.Text = "&Help";
            menuItem3.Items.Add(_menuItemAbout);

            var horizontalMenu1 = new HorizontalMenu();

            horizontalMenu1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            horizontalMenu1.Items.Add(menuItem1);
            horizontalMenu1.Items.Add(menuItem2);
            horizontalMenu1.Items.Add(menuItem3);

            var textBlock1 = new TextBlock();

            textBlock1.Text = "Button:";
            textBlock1.Id   = "";

            _buttonSaveFile              = new Button();
            _buttonSaveFile.Text         = "Save File";
            _buttonSaveFile.Id           = "_buttonSaveFile";
            _buttonSaveFile.PaddingLeft  = 8;
            _buttonSaveFile.PaddingRight = 8;
            _buttonSaveFile.GridColumn   = 1;

            _textSaveFile            = new TextField();
            _textSaveFile.Text       = "";
            _textSaveFile.Id         = "_textSaveFile";
            _textSaveFile.GridColumn = 2;

            var textBlock2 = new TextBlock();

            textBlock2.Text    = "Another Button:";
            textBlock2.Id      = "";
            textBlock2.GridRow = 1;

            _buttonOpenFile              = new Button();
            _buttonOpenFile.Text         = "Open File";
            _buttonOpenFile.Id           = "_buttonOpenFile";
            _buttonOpenFile.PaddingLeft  = 8;
            _buttonOpenFile.PaddingRight = 8;
            _buttonOpenFile.GridColumn   = 1;
            _buttonOpenFile.GridRow      = 1;

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

            var textBlock3 = new TextBlock();

            textBlock3.Text    = "Blue Button:";
            textBlock3.Id      = "";
            textBlock3.GridRow = 2;

            _buttonChooseFolder              = new Button("blue");
            _buttonChooseFolder.Text         = "Choose Folder";
            _buttonChooseFolder.Id           = "_buttonChooseFolder";
            _buttonChooseFolder.PaddingLeft  = 8;
            _buttonChooseFolder.PaddingRight = 8;
            _buttonChooseFolder.GridColumn   = 1;
            _buttonChooseFolder.GridRow      = 2;

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

            _textButtonLabel         = new TextBlock();
            _textButtonLabel.Text    = "Text Button:";
            _textButtonLabel.Id      = "_textButtonLabel";
            _textButtonLabel.GridRow = 3;

            _buttonChooseColor              = new TextButton();
            _buttonChooseColor.Text         = "Choose Color";
            _buttonChooseColor.Id           = "_buttonChooseColor";
            _buttonChooseColor.PaddingLeft  = 8;
            _buttonChooseColor.PaddingRight = 8;
            _buttonChooseColor.GridColumn   = 1;
            _buttonChooseColor.GridRow      = 3;

            var textBlock4 = new TextBlock();

            textBlock4.Text    = "Image Button:";
            textBlock4.Id      = "";
            textBlock4.GridRow = 4;

            _imageButton              = new ImageButton();
            _imageButton.Id           = "_imageButton";
            _imageButton.PaddingLeft  = 8;
            _imageButton.PaddingRight = 8;
            _imageButton.GridColumn   = 1;
            _imageButton.GridRow      = 4;

            var checkBox1 = new CheckBox();

            checkBox1.Text           = "This is checkbox";
            checkBox1.ImageWidth     = 10;
            checkBox1.ImageHeight    = 10;
            checkBox1.GridRow        = 5;
            checkBox1.GridColumnSpan = 2;

            var textBlock5 = new TextBlock();

            textBlock5.Text    = "Horizontal Slider:";
            textBlock5.Id      = "";
            textBlock5.GridRow = 6;

            var horizontalSlider1 = new HorizontalSlider();

            horizontalSlider1.GridColumn     = 1;
            horizontalSlider1.GridRow        = 6;
            horizontalSlider1.GridColumnSpan = 2;

            var textBlock6 = new TextBlock();

            textBlock6.Text    = "Combo Box:";
            textBlock6.GridRow = 7;

            var listItem1 = new ListItem();

            listItem1.Id    = "";
            listItem1.Text  = "Red";
            listItem1.Color = Color.Red;

            var listItem2 = new ListItem();

            listItem2.Id    = null;
            listItem2.Text  = "Green";
            listItem2.Color = Color.Lime;

            var listItem3 = new ListItem();

            listItem3.Id    = null;
            listItem3.Text  = "Blue";
            listItem3.Color = new Color
            {
                B = 255,
                G = 128,
                R = 0,
                A = 255,
            };

            var comboBox1 = new ComboBox();

            comboBox1.SelectedIndex  = 1;
            comboBox1.Width          = 200;
            comboBox1.GridColumn     = 1;
            comboBox1.GridRow        = 7;
            comboBox1.GridColumnSpan = 2;
            comboBox1.Items.Add(listItem1);
            comboBox1.Items.Add(listItem2);
            comboBox1.Items.Add(listItem3);

            var textBlock7 = new TextBlock();

            textBlock7.Text    = "Text Field:";
            textBlock7.GridRow = 8;

            var textField1 = new TextField();

            textField1.Text           = "";
            textField1.GridColumn     = 1;
            textField1.GridRow        = 8;
            textField1.GridColumnSpan = 2;

            var textBlock8 = new TextBlock();

            textBlock8.Text    = "Spin Button:";
            textBlock8.GridRow = 9;

            var spinButton1 = new SpinButton();

            spinButton1.Width      = 100;
            spinButton1.GridColumn = 1;
            spinButton1.GridRow    = 9;

            var textBlock9 = new TextBlock();

            textBlock9.Text    = "List Box:";
            textBlock9.GridRow = 10;

            var listItem4 = new ListItem();

            listItem4.Id    = null;
            listItem4.Text  = "Red";
            listItem4.Color = Color.Red;

            var listItem5 = new ListItem();

            listItem5.Id    = null;
            listItem5.Text  = "Green";
            listItem5.Color = Color.Lime;

            var listItem6 = new ListItem();

            listItem6.Id    = null;
            listItem6.Text  = "Blue";
            listItem6.Color = Color.Blue;

            var listBox1 = new ListBox();

            listBox1.Width          = 200;
            listBox1.GridColumn     = 1;
            listBox1.GridRow        = 10;
            listBox1.GridColumnSpan = 2;
            listBox1.Items.Add(listItem4);
            listBox1.Items.Add(listItem5);
            listBox1.Items.Add(listItem6);

            var textBlock10 = new TextBlock();

            textBlock10.Text    = "Vertical Menu:";
            textBlock10.GridRow = 11;

            var menuItem4 = new MenuItem();

            menuItem4.Id   = "";
            menuItem4.Text = "Start New Game";

            var menuItem5 = new MenuItem();

            menuItem5.Id   = "";
            menuItem5.Text = "Options";

            var menuItem6 = new MenuItem();

            menuItem6.Id   = "";
            menuItem6.Text = "Quit";

            var verticalMenu1 = new VerticalMenu();

            verticalMenu1.GridColumn = 1;
            verticalMenu1.GridRow    = 11;
            verticalMenu1.Items.Add(menuItem4);
            verticalMenu1.Items.Add(menuItem5);
            verticalMenu1.Items.Add(menuItem6);

            var textBlock11 = new TextBlock();

            textBlock11.Text    = "Tree";
            textBlock11.GridRow = 12;

            _gridRight = new Grid();
            _gridRight.ColumnSpacing = 8;
            _gridRight.RowSpacing    = 8;
            _gridRight.ColumnsProportions.Add(new Grid.Proportion());
            _gridRight.ColumnsProportions.Add(new Grid.Proportion());
            _gridRight.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.RowsProportions.Add(new Grid.Proportion());
            _gridRight.Id = "_gridRight";
            _gridRight.Widgets.Add(textBlock1);
            _gridRight.Widgets.Add(_buttonSaveFile);
            _gridRight.Widgets.Add(_textSaveFile);
            _gridRight.Widgets.Add(textBlock2);
            _gridRight.Widgets.Add(_buttonOpenFile);
            _gridRight.Widgets.Add(_textOpenFile);
            _gridRight.Widgets.Add(textBlock3);
            _gridRight.Widgets.Add(_buttonChooseFolder);
            _gridRight.Widgets.Add(_textChooseFolder);
            _gridRight.Widgets.Add(_textButtonLabel);
            _gridRight.Widgets.Add(_buttonChooseColor);
            _gridRight.Widgets.Add(textBlock4);
            _gridRight.Widgets.Add(_imageButton);
            _gridRight.Widgets.Add(checkBox1);
            _gridRight.Widgets.Add(textBlock5);
            _gridRight.Widgets.Add(horizontalSlider1);
            _gridRight.Widgets.Add(textBlock6);
            _gridRight.Widgets.Add(comboBox1);
            _gridRight.Widgets.Add(textBlock7);
            _gridRight.Widgets.Add(textField1);
            _gridRight.Widgets.Add(textBlock8);
            _gridRight.Widgets.Add(spinButton1);
            _gridRight.Widgets.Add(textBlock9);
            _gridRight.Widgets.Add(listBox1);
            _gridRight.Widgets.Add(textBlock10);
            _gridRight.Widgets.Add(verticalMenu1);
            _gridRight.Widgets.Add(textBlock11);

            var scrollPane1 = new ScrollPane();

            scrollPane1.Child = _gridRight;

            var textBlock12 = new TextBlock();

            textBlock12.Text = "Vertical Slider:";

            var verticalSlider1 = new VerticalSlider();

            verticalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            verticalSlider1.GridRow             = 1;

            var grid1 = new Grid();

            grid1.RowSpacing = 8;
            grid1.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.Widgets.Add(textBlock12);
            grid1.Widgets.Add(verticalSlider1);

            var textBlock13 = new TextBlock();

            textBlock13.Text = "Progress Bars:";

            _horizontalProgressBar         = new HorizontalProgressBar();
            _horizontalProgressBar.Id      = "_horizontalProgressBar";
            _horizontalProgressBar.GridRow = 1;

            _verticalProgressBar = new VerticalProgressBar();
            _verticalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _verticalProgressBar.Id      = "_verticalProgressBar";
            _verticalProgressBar.GridRow = 2;

            var grid2 = new Grid();

            grid2.RowSpacing = 8;
            grid2.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.GridRow = 2;
            grid2.Widgets.Add(textBlock13);
            grid2.Widgets.Add(_horizontalProgressBar);
            grid2.Widgets.Add(_verticalProgressBar);

            var verticalSplitPane1 = new VerticalSplitPane();

            verticalSplitPane1.GridColumn = 2;
            verticalSplitPane1.Widgets.Add(grid1);
            verticalSplitPane1.Widgets.Add(grid2);

            var horizontalSplitPane1 = new HorizontalSplitPane();

            horizontalSplitPane1.GridRow = 1;
            horizontalSplitPane1.Widgets.Add(scrollPane1);
            horizontalSplitPane1.Widgets.Add(verticalSplitPane1);


            RowSpacing = 8;
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            Id = "Root";
            Widgets.Add(horizontalMenu1);
            Widgets.Add(horizontalSplitPane1);
        }
Ejemplo n.º 22
0
        private void BuildUI()
        {
            _menuFileNew      = new MenuItem();
            _menuFileNew.Id   = "_menuFileNew";
            _menuFileNew.Text = "&New";

            _menuFileOpen      = new MenuItem();
            _menuFileOpen.Id   = "_menuFileOpen";
            _menuFileOpen.Text = "&Open";

            _menuFileReload      = new MenuItem();
            _menuFileReload.Id   = "_menuFileReload";
            _menuFileReload.Text = "&Reload";

            _menuFileSave      = new MenuItem();
            _menuFileSave.Id   = "_menuFileSave";
            _menuFileSave.Text = "&Save";

            _menuFileSaveAs      = new MenuItem();
            _menuFileSaveAs.Id   = "_menuFileSaveAs";
            _menuFileSaveAs.Text = "Save &As...";

            _menuFileExportToCS      = new MenuItem();
            _menuFileExportToCS.Id   = "_menuFileExportToCS";
            _menuFileExportToCS.Text = "&Export To C#...";

            var menuSeparator1 = new MenuSeparator();

            _menuFileLoadStylesheet      = new MenuItem();
            _menuFileLoadStylesheet.Id   = "_menuFileLoadStylesheet";
            _menuFileLoadStylesheet.Text = "&Load Stylesheet";

            _menuFileReloadStylesheet      = new MenuItem();
            _menuFileReloadStylesheet.Id   = "_menuFileReloadStylesheet";
            _menuFileReloadStylesheet.Text = "Rel&oad Stylesheet";

            _menuFileResetStylesheet      = new MenuItem();
            _menuFileResetStylesheet.Id   = "_menuFileResetStylesheet";
            _menuFileResetStylesheet.Text = "Rese&t Stylesheet";

            var menuSeparator2 = new MenuSeparator();

            _menuFileDebugOptions      = new MenuItem();
            _menuFileDebugOptions.Id   = "_menuFileDebugOptions";
            _menuFileDebugOptions.Text = "&UI Debug Options";

            var menuSeparator3 = new MenuSeparator();

            _menuFileQuit      = new MenuItem();
            _menuFileQuit.Id   = "_menuFileQuit";
            _menuFileQuit.Text = "&Quit";

            var menuItem1 = new MenuItem();

            menuItem1.Id   = "";
            menuItem1.Text = "&File";
            menuItem1.Items.Add(_menuFileNew);
            menuItem1.Items.Add(_menuFileOpen);
            menuItem1.Items.Add(_menuFileReload);
            menuItem1.Items.Add(_menuFileSave);
            menuItem1.Items.Add(_menuFileSaveAs);
            menuItem1.Items.Add(_menuFileExportToCS);
            menuItem1.Items.Add(menuSeparator1);
            menuItem1.Items.Add(_menuFileLoadStylesheet);
            menuItem1.Items.Add(_menuFileReloadStylesheet);
            menuItem1.Items.Add(_menuFileResetStylesheet);
            menuItem1.Items.Add(menuSeparator2);
            menuItem1.Items.Add(_menuFileDebugOptions);
            menuItem1.Items.Add(menuSeparator3);
            menuItem1.Items.Add(_menuFileQuit);

            _menuEditFormatSource      = new MenuItem();
            _menuEditFormatSource.Id   = "_menuEditFormatSource";
            _menuEditFormatSource.Text = "&Format Source";

            var menuItem2 = new MenuItem();

            menuItem2.Id   = "";
            menuItem2.Text = "&Edit";
            menuItem2.Items.Add(_menuEditFormatSource);

            _menuHelpAbout      = new MenuItem();
            _menuHelpAbout.Id   = "_menuHelpAbout";
            _menuHelpAbout.Text = "&About";

            var menuItem3 = new MenuItem();

            menuItem3.Id   = "";
            menuItem3.Text = "&Help";
            menuItem3.Items.Add(_menuHelpAbout);

            var horizontalMenu1 = new HorizontalMenu();

            horizontalMenu1.Id = "";
            horizontalMenu1.Items.Add(menuItem1);
            horizontalMenu1.Items.Add(menuItem2);
            horizontalMenu1.Items.Add(menuItem3);

            _projectHolder    = new Panel();
            _projectHolder.Id = "_projectHolder";

            _textSource                   = new TextField();
            _textSource.Text              = "";
            _textSource.Multiline         = true;
            _textSource.Wrap              = true;
            _textSource.Id                = "_textSource";
            _textSource.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _textSource.GridRow           = 2;

            var scrollPane1 = new ScrollPane();

            scrollPane1.GridRow = 2;
            scrollPane1.Content = _textSource;

            _leftSplitPane    = new VerticalSplitPane();
            _leftSplitPane.Id = "_leftSplitPane";
            _leftSplitPane.Widgets.Add(_projectHolder);
            _leftSplitPane.Widgets.Add(scrollPane1);

            var horizontalSeparator1 = new HorizontalSeparator();

            horizontalSeparator1.GridRow = 1;

            _textStatus         = new TextBlock();
            _textStatus.Text    = "Reloading...";
            _textStatus.Id      = "_textStatus";
            _textStatus.GridRow = 2;

            var grid1 = new Grid();

            grid1.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.Widgets.Add(_leftSplitPane);
            grid1.Widgets.Add(horizontalSeparator1);
            grid1.Widgets.Add(_textStatus);

            _propertyGridPane         = new ScrollPane();
            _propertyGridPane.Content = null;
            _propertyGridPane.Id      = "_propertyGridPane";

            var horizontalSeparator2 = new HorizontalSeparator();

            horizontalSeparator2.GridRow = 1;

            _textLocation         = new TextBlock();
            _textLocation.Text    = "Line: 1, Column: 2, Indent: 3";
            _textLocation.Id      = "_textLocation";
            _textLocation.GridRow = 2;

            var grid2 = new Grid();

            grid2.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.GridColumn = 2;
            grid2.Widgets.Add(_propertyGridPane);
            grid2.Widgets.Add(horizontalSeparator2);
            grid2.Widgets.Add(_textLocation);

            _topSplitPane         = new HorizontalSplitPane();
            _topSplitPane.Id      = "_topSplitPane";
            _topSplitPane.GridRow = 1;
            _topSplitPane.Widgets.Add(grid1);
            _topSplitPane.Widgets.Add(grid2);


            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            Id = "Root";
            Widgets.Add(horizontalMenu1);
            Widgets.Add(_topSplitPane);
        }
        public override void initialize()
        {
            this.Communication = Nez.Core.services.GetService <CommunicationManager>();
            setDesignResolution(1280, 720, Scene.SceneResolutionPolicy.NoBorderPixelPerfect);
            Screen.setSize(1280, 720);
            var myRenderer = new ScreenSpaceRenderer(100, SCREEN_SPACE_RENDER_LAYER);

            myRenderer.wantsToRenderAfterPostProcessors = false;
            addRenderer(myRenderer);
            var myGUIRenderer = new RenderLayerExcludeRenderer(0, SCREEN_SPACE_RENDER_LAYER);

            addRenderer(myGUIRenderer);
            canvas = createEntity("GUI").addComponent(new UICanvas());
            Texture2D LoginBackground = content.Load <Texture2D>("GUI/Login Elements/LoginBackground");

            //canvas.isFullScreen = true;
            canvas.stage.addElement(new Image(LoginBackground));
            ScrollPaneStyle myScrollStyle = new ScrollPaneStyle();

            myScrollStyle.hScrollKnob = new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Scrollbar/ScrollHandle"));
            myScrollStyle.hScroll     = new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Scrollbar/HScrollBar"));
            Bodies = new ScrollPane(myBodyGroup, myScrollStyle);
            Hair   = new ScrollPane(aHairGroup, myScrollStyle);
            HorizontalGroup myHGroup = new HorizontalGroup();

            myHGroup.setAlignment(Align.left);
            myHGroup.setY(70);
            myHGroup.setSpacing(0);
            VerticalGroup myCharacterDataGroup = new VerticalGroup();

            myCharacterDataGroup.setSpacing(20);
            myCharacterDataGroup.setAlignment(Align.left);
            myCharacterViewerGroup = new VerticalGroup();
            myCharacterViewerGroup.setY(70);
            HorizontalGroup mySexGroup = new HorizontalGroup();

            mySexGroup.setSpacing(10);


            CheckBox Male = new CheckBox("Male", new CheckBoxStyle(new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Unchecked")), new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Checked")), Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));

            myDisplayedHair = new Image();
            myDisplayedBody = new Image();
            myImageStack.addElement(myDisplayedBody);
            myImageStack.addElement(myDisplayedHair);
            var ContainerStack = new Container(myImageStack);

            ContainerStack.setWidth(128);
            ContainerStack.setHeight(128);
            myCharacterViewerGroup.addElement(ContainerStack);

            CharacterCreatorSwitch = new Button(new ButtonStyle(new SubtextureDrawable(Core.content.Load <Texture2D>("GUI/Buttons/savebutton")), new SubtextureDrawable(Core.content.Load <Texture2D>("GUI/Buttons/savebutton")), new SubtextureDrawable(Core.content.Load <Texture2D>("GUI/Buttons/savebutton"))));
            CharacterCreatorSwitch.setTouchable(Touchable.Disabled);
            myCharacterViewerGroup.setAlignment(Align.bottom);
            myCharacterViewerGroup.addElement(Bodies);
            myCharacterViewerGroup.addElement(Hair);
            myCharacterViewerGroup.setPadTop(270);
            CheckBox Female = new CheckBox("Female", new CheckBoxStyle(new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Unchecked")), new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Checked")), Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));

            Male.onChanged += delegate(bool myResult)
            {
                if (myResult)
                {
                    PlayerData.Sex = GameData.GameDataClasses.Entities.SEX.MALE;
                }
                else
                {
                    PlayerData.Sex = null;
                }
                Female.programmaticChangeEvents = false; //Prevents it from firing.
                Female.isChecked = false;
                Female.programmaticChangeEvents = true;
                UpdateCharacterWindow();
            };
            Female.onChanged += delegate(bool myResult)
            {
                if (myResult)
                {
                    PlayerData.Sex = GameData.GameDataClasses.Entities.SEX.FEMALE;
                }
                else
                {
                    PlayerData.Sex = null;
                }
                Male.programmaticChangeEvents = false; //Prevents it from firing.
                Male.isChecked = false;
                Male.programmaticChangeEvents = true;
                UpdateCharacterWindow();
            };

            mySexGroup.addElement(Male);
            mySexGroup.addElement(Female);
            myCharacterDataGroup.addElement(mySexGroup);
            HorizontalGroup myRaceGroupAndDescription = new HorizontalGroup();
            VerticalGroup   myRaceGroup  = new VerticalGroup();
            List <CheckBox> myRaceChecks = new List <CheckBox>();

            foreach (String A in Directory.EnumerateFiles("./Content/Races"))
            {
                String   aRacename   = Path.GetFileNameWithoutExtension(A);
                Race     aLoadedRace = Nez.Core.content.Load <Race>("Races/" + aRacename);
                CheckBox aNewRace    = new CheckBox(aRacename, new CheckBoxStyle(new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Unchecked")), new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Checked")), Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));
                myRaceChecks.Add(aNewRace);
                aNewRace.onChanged += delegate(bool myResult)
                {
                    var Racebox = aNewRace;
                    if (myResult)
                    {
                        foreach (CheckBox a in myRaceChecks)
                        {
                            if (Racebox != a)
                            {
                                a.isChecked = false;
                            }
                        }

                        Race myInternalRace = aLoadedRace;
                        SetRace(myInternalRace);
                        UpdateCharacterWindow();
                    }
                    else
                    {
                        SetRace(null);
                        UpdateCharacterWindow();
                    }
                };
                aNewRace.OnMouseOver += delegate(bool myResult)
                {
                    if (myResult)
                    {
                        Race myInternalRace = aLoadedRace;
                        myRaceDescription.setText(myInternalRace.Description);
                        myRaceDescription.setWrap(true);
                    }
                    else
                    {
                        myRaceDescription.setText("");
                    }
                };
                myRaceGroup.addElement(aNewRace);
            }
            myRaceDescription = new Label("Race Description HERE");
            myRaceDescription.setWidth(Screen.width * 0.25f);
            myRaceDescription.setHeight(30);
            myRaceDescription.setWrap(true);
            myRaceGroup.setAlignment(Align.bottomLeft);
            myRaceGroupAndDescription.setSpacing(10);
            myRaceGroupAndDescription.setWidth(100);
            myRaceGroupAndDescription.addElement(myRaceGroup);
            myRaceGroupAndDescription.setAlignment(Align.left);
            Container aRaceDescriptionHolder = new Container();

            aRaceDescriptionHolder.setSize(Screen.width * 0.25f, 30);
            aRaceDescriptionHolder.setY(0);
            aRaceDescriptionHolder.addElement(myRaceDescription);
            myRaceGroupAndDescription.addElement(aRaceDescriptionHolder);
            myCharacterDataGroup.addElement(myRaceGroupAndDescription);
            myHGroup.addElement(myCharacterDataGroup);
            myHGroup.addElement(myCharacterViewerGroup);
            //Professions GUI
            HorizontalGroup myHorizontalProfessions = new HorizontalGroup();
            VerticalGroup   myProfessionsbox        = new VerticalGroup();

            //Iterate professions however we're doing it
            myHorizontalProfessions.addElement(myProfessionsbox);
            VerticalGroup myProfessionsDesc       = new VerticalGroup();
            Label         myProfessionDescription = new Label("Profession Description HERE");

            myProfessionsDesc.addElement(myProfessionDescription);
            Label myProfessionAlert = new Label("Profession Alertbox HERE");

            myProfessionsDesc.addElement(myProfessionAlert);
            myHorizontalProfessions.addElement(myProfessionsDesc);
            myCharacterDataGroup.addElement(myHorizontalProfessions);
            canvas.stage.addElement(myHGroup);
            //myHGroup.add(myInternalHGroup);*/
            base.initialize();
        }
Ejemplo n.º 24
0
        private void BuildUI()
        {
            _menuFileNew      = new MenuItem();
            _menuFileNew.Id   = "_menuFileNew";
            _menuFileNew.Text = "&New";

            _menuFileOpen      = new MenuItem();
            _menuFileOpen.Id   = "_menuFileOpen";
            _menuFileOpen.Text = "&Open";

            _menuFileSave      = new MenuItem();
            _menuFileSave.Id   = "_menuFileSave";
            _menuFileSave.Text = "&Save";

            _menuFileSaveAs      = new MenuItem();
            _menuFileSaveAs.Id   = "_menuFileSaveAs";
            _menuFileSaveAs.Text = "Save &As...";

            _menuFileExportToCS      = new MenuItem();
            _menuFileExportToCS.Id   = "_menuFileExportToCS";
            _menuFileExportToCS.Text = "&Export To C#...";

            var menuSeparator1 = new MenuSeparator();

            _menuFileDebugOptions      = new MenuItem();
            _menuFileDebugOptions.Id   = "_menuFileDebugOptions";
            _menuFileDebugOptions.Text = "&UI Debug Options";

            var menuSeparator2 = new MenuSeparator();

            _menuFileQuit      = new MenuItem();
            _menuFileQuit.Id   = "_menuFileQuit";
            _menuFileQuit.Text = "&Quit";

            var menuItem1 = new MenuItem();

            menuItem1.Id   = "";
            menuItem1.Text = "&File";
            menuItem1.Items.Add(_menuFileNew);
            menuItem1.Items.Add(_menuFileOpen);
            menuItem1.Items.Add(_menuFileSave);
            menuItem1.Items.Add(_menuFileSaveAs);
            menuItem1.Items.Add(_menuFileExportToCS);
            menuItem1.Items.Add(menuSeparator1);
            menuItem1.Items.Add(_menuFileDebugOptions);
            menuItem1.Items.Add(menuSeparator2);
            menuItem1.Items.Add(_menuFileQuit);

            _menuControlsAddButton      = new MenuItem();
            _menuControlsAddButton.Id   = "_menuControlsAddButton";
            _menuControlsAddButton.Text = "Add Button";

            _menuControlsAddCheckBox      = new MenuItem();
            _menuControlsAddCheckBox.Id   = "_menuControlsAddCheckBox";
            _menuControlsAddCheckBox.Text = "Add CheckBox";

            _menuControlsAddImageButton      = new MenuItem();
            _menuControlsAddImageButton.Id   = "_menuControlsAddImageButton";
            _menuControlsAddImageButton.Text = "Add ImageButton";

            _menuControlsAddTextButton      = new MenuItem();
            _menuControlsAddTextButton.Id   = "_menuControlsAddTextButton";
            _menuControlsAddTextButton.Text = "Add TextButton";

            _menuControlsAddHorizontalSlider      = new MenuItem();
            _menuControlsAddHorizontalSlider.Id   = "_menuControlsAddHorizontalSlider";
            _menuControlsAddHorizontalSlider.Text = "Add HorizontalSlider";

            _menuControlsAddVerticalSlider      = new MenuItem();
            _menuControlsAddVerticalSlider.Id   = "_menuControlsAddVerticalSlider";
            _menuControlsAddVerticalSlider.Text = "Add VerticalSlider";

            _menuControlsAddHorizontalProgressBar      = new MenuItem();
            _menuControlsAddHorizontalProgressBar.Id   = "_menuControlsAddHorizontalProgressBar";
            _menuControlsAddHorizontalProgressBar.Text = "Add Horizontal ProgressBar";

            _menuControlsAddVerticalProgressBar      = new MenuItem();
            _menuControlsAddVerticalProgressBar.Id   = "_menuControlsAddVerticalProgressBar";
            _menuControlsAddVerticalProgressBar.Text = "Add Vertical ProgressBar";

            _menuControlsAddComboBox      = new MenuItem();
            _menuControlsAddComboBox.Id   = "_menuControlsAddComboBox";
            _menuControlsAddComboBox.Text = "Add ComboBox";

            _menuControlsAddListBox      = new MenuItem();
            _menuControlsAddListBox.Id   = "_menuControlsAddListBox";
            _menuControlsAddListBox.Text = "Add ListBox";

            _menuControlsAddImage      = new MenuItem();
            _menuControlsAddImage.Id   = "_menuControlsAddImage";
            _menuControlsAddImage.Text = "Add Image";

            _menuControlsAddTextBlock      = new MenuItem();
            _menuControlsAddTextBlock.Id   = "_menuControlsAddTextBlock";
            _menuControlsAddTextBlock.Text = "Add TextBlock";

            _menuControlsAddTextField      = new MenuItem();
            _menuControlsAddTextField.Id   = "_menuControlsAddTextField";
            _menuControlsAddTextField.Text = "Add TextField";

            _menuControlsAddSpinButton      = new MenuItem();
            _menuControlsAddSpinButton.Id   = "_menuControlsAddSpinButton";
            _menuControlsAddSpinButton.Text = "Add SpinButton";

            var menuSeparator3 = new MenuSeparator();

            _menuControlsAddPanel      = new MenuItem();
            _menuControlsAddPanel.Id   = "_menuControlsAddPanel";
            _menuControlsAddPanel.Text = "Add Panel";

            _menuControlsAddGrid      = new MenuItem();
            _menuControlsAddGrid.Id   = "_menuControlsAddGrid";
            _menuControlsAddGrid.Text = "Add Grid";

            _menuControlsAddScrollPane      = new MenuItem();
            _menuControlsAddScrollPane.Id   = "_menuControlsAddScrollPane";
            _menuControlsAddScrollPane.Text = "Add ScrollPane";

            _menuControlsAddHorizontalSplitPane      = new MenuItem();
            _menuControlsAddHorizontalSplitPane.Id   = "_menuControlsAddHorizontalSplitPane";
            _menuControlsAddHorizontalSplitPane.Text = "Add Horizontal SplitPane";

            _menuControlsAddVerticalSplitPane      = new MenuItem();
            _menuControlsAddVerticalSplitPane.Id   = "_menuControlsAddVerticalSplitPane";
            _menuControlsAddVerticalSplitPane.Text = "Add Vertical SplitPane";

            var menuSeparator4 = new MenuSeparator();

            _menuControlsAddHorizontalMenu      = new MenuItem();
            _menuControlsAddHorizontalMenu.Id   = "_menuControlsAddHorizontalMenu";
            _menuControlsAddHorizontalMenu.Text = "Add HorizontalMenu";

            _menuControlsAddVerticalMenu      = new MenuItem();
            _menuControlsAddVerticalMenu.Id   = "_menuControlsAddVerticalMenu";
            _menuControlsAddVerticalMenu.Text = "Add Vertical Menu";

            _menuControlsAddMenuItem      = new MenuItem();
            _menuControlsAddMenuItem.Id   = "_menuControlsAddMenuItem";
            _menuControlsAddMenuItem.Text = "Add Menu Item";

            _menuControlsAddMenuSeparator      = new MenuItem();
            _menuControlsAddMenuSeparator.Id   = "_menuControlsAddMenuSeparator";
            _menuControlsAddMenuSeparator.Text = "Add Menu Separator";

            _menuControls      = new MenuItem();
            _menuControls.Id   = "_menuControls";
            _menuControls.Text = "&Controls";
            _menuControls.Items.Add(_menuControlsAddButton);
            _menuControls.Items.Add(_menuControlsAddCheckBox);
            _menuControls.Items.Add(_menuControlsAddImageButton);
            _menuControls.Items.Add(_menuControlsAddTextButton);
            _menuControls.Items.Add(_menuControlsAddHorizontalSlider);
            _menuControls.Items.Add(_menuControlsAddVerticalSlider);
            _menuControls.Items.Add(_menuControlsAddHorizontalProgressBar);
            _menuControls.Items.Add(_menuControlsAddVerticalProgressBar);
            _menuControls.Items.Add(_menuControlsAddComboBox);
            _menuControls.Items.Add(_menuControlsAddListBox);
            _menuControls.Items.Add(_menuControlsAddImage);
            _menuControls.Items.Add(_menuControlsAddTextBlock);
            _menuControls.Items.Add(_menuControlsAddTextField);
            _menuControls.Items.Add(_menuControlsAddSpinButton);
            _menuControls.Items.Add(menuSeparator3);
            _menuControls.Items.Add(_menuControlsAddPanel);
            _menuControls.Items.Add(_menuControlsAddGrid);
            _menuControls.Items.Add(_menuControlsAddScrollPane);
            _menuControls.Items.Add(_menuControlsAddHorizontalSplitPane);
            _menuControls.Items.Add(_menuControlsAddVerticalSplitPane);
            _menuControls.Items.Add(menuSeparator4);
            _menuControls.Items.Add(_menuControlsAddHorizontalMenu);
            _menuControls.Items.Add(_menuControlsAddVerticalMenu);
            _menuControls.Items.Add(_menuControlsAddMenuItem);
            _menuControls.Items.Add(_menuControlsAddMenuSeparator);

            _menuHelpAbout      = new MenuItem();
            _menuHelpAbout.Id   = "_menuHelpAbout";
            _menuHelpAbout.Text = "&About";

            var menuItem2 = new MenuItem();

            menuItem2.Id   = "";
            menuItem2.Text = "&Help";
            menuItem2.Items.Add(_menuHelpAbout);

            var horizontalMenu1 = new HorizontalMenu();

            horizontalMenu1.DrawLinesColor      = Color.White;
            horizontalMenu1.Id                  = "";
            horizontalMenu1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            horizontalMenu1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            horizontalMenu1.Items.Add(menuItem1);
            horizontalMenu1.Items.Add(_menuControls);
            horizontalMenu1.Items.Add(menuItem2);

            _projectHolder    = new Panel();
            _projectHolder.Id = "_projectHolder";
            _projectHolder.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _projectHolder.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;

            _explorerHolder    = new Panel();
            _explorerHolder.Id = "_explorerHolder";
            _explorerHolder.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _explorerHolder.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;

            _propertyGridPane    = new ScrollPane();
            _propertyGridPane.Id = "_propertyGridPane";
            _propertyGridPane.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _propertyGridPane.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _propertyGridPane.GridPositionY       = 2;
            _propertyGridPane.ClipToBounds        = true;
            _propertyGridPane.CanFocus            = true;

            _rightSplitPane    = new VerticalSplitPane();
            _rightSplitPane.Id = "_rightSplitPane";
            _rightSplitPane.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _rightSplitPane.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _rightSplitPane.GridPositionX       = 2;
            _rightSplitPane.Widgets.Add(_explorerHolder);
            _rightSplitPane.Widgets.Add(_propertyGridPane);

            _topSplitPane    = new HorizontalSplitPane();
            _topSplitPane.Id = "_topSplitPane";
            _topSplitPane.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _topSplitPane.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _topSplitPane.GridPositionY       = 1;
            _topSplitPane.Widgets.Add(_projectHolder);
            _topSplitPane.Widgets.Add(_rightSplitPane);


            DrawLinesColor = Color.White;
            RowsProportions.Add(new Proportion());
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            Id = "Root";
            HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            Widgets.Add(horizontalMenu1);
            Widgets.Add(_topSplitPane);
        }
Ejemplo n.º 25
0
        private void BuildUI()
        {
            _buttonBack    = new ImageButton();
            _buttonBack.Id = "_buttonBack";
            _buttonBack.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonBack.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;

            _buttonForward    = new ImageButton();
            _buttonForward.Id = "_buttonForward";
            _buttonForward.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonForward.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonForward.GridColumn          = 1;

            _textFieldPath                   = new TextField();
            _textFieldPath.Text              = "";
            _textFieldPath.Readonly          = true;
            _textFieldPath.Id                = "_textFieldPath";
            _textFieldPath.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _textFieldPath.GridColumn        = 2;

            _buttonParent    = new ImageButton();
            _buttonParent.Id = "_buttonParent";
            _buttonParent.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonParent.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonParent.GridColumn          = 3;

            var grid1 = new Grid();

            grid1.ColumnSpacing = 4;
            grid1.ColumnsProportions.Add(new Grid.Proportion());
            grid1.ColumnsProportions.Add(new Grid.Proportion());
            grid1.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid1.ColumnsProportions.Add(new Grid.Proportion());
            grid1.Widgets.Add(_buttonBack);
            grid1.Widgets.Add(_buttonForward);
            grid1.Widgets.Add(_textFieldPath);
            grid1.Widgets.Add(_buttonParent);

            _listBoxPlaces    = new ListBox();
            _listBoxPlaces.Id = "_listBoxPlaces";
            _listBoxPlaces.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _listBoxPlaces.ClipToBounds        = true;

            _gridFiles = new Grid();
            _gridFiles.ColumnSpacing = 4;
            _gridFiles.RowSpacing    = 4;
            _gridFiles.ColumnsProportions.Add(new Grid.Proportion());
            _gridFiles.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            _gridFiles.GridSelectionMode = Myra.Graphics2D.UI.GridSelectionMode.Row;
            _gridFiles.Id = "_gridFiles";

            _scrollPane = new ScrollPane();
            _scrollPane.ShowHorizontalScrollBar = false;
            _scrollPane.Id         = "_scrollPane";
            _scrollPane.GridColumn = 2;
            _scrollPane.Child      = _gridFiles;

            _splitPane         = new HorizontalSplitPane();
            _splitPane.Id      = "_splitPane";
            _splitPane.GridRow = 1;
            _splitPane.Widgets.Add(_listBoxPlaces);
            _splitPane.Widgets.Add(_scrollPane);

            _textBlockFileName      = new TextBlock();
            _textBlockFileName.Text = "File name";
            _textBlockFileName.Id   = "_textBlockFileName";

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

            var grid2 = new Grid();

            grid2.ColumnSpacing = 4;
            grid2.ColumnsProportions.Add(new Grid.Proportion());
            grid2.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.GridRow = 2;
            grid2.Widgets.Add(_textBlockFileName);
            grid2.Widgets.Add(_textFieldFileName);

            var grid3 = new Grid();

            grid3.RowSpacing = 4;
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.GridRow = 1;
            grid3.Widgets.Add(grid1);
            grid3.Widgets.Add(_splitPane);
            grid3.Widgets.Add(grid2);


            Title   = "Open File...";
            Left    = 174;
            Width   = 600;
            Height  = 400;
            Content = grid3;
        }
Ejemplo n.º 26
0
        protected override void LoadContent()
        {
            base.LoadContent();

            MyraEnvironment.Game = this;

            // Widget.DrawFrames = true;
            _host = new Desktop();

            var grid = new Grid
            {
                RowSpacing    = 3,
                ColumnSpacing = 3,
                //				DrawLines = true
            };

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

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

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

                grid.Widgets.Add(header);
            }

            // Combo
            var combo = new ComboBox
            {
                GridPositionX = 1,
                GridPositionY = 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));
            grid.Widgets.Add(combo);

            // Button
            var button = new Button
            {
                GridPositionX       = 2,
                GridPositionY       = 1,
                GridSpanX           = 2,
                GridSpanY           = 1,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Text = "This is 2 columns button"
            };

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

            grid.Widgets.Add(button);

            // Button
            var button2 = new Button
            {
                GridPositionX       = 2,
                GridPositionY       = 2,
                GridSpanX           = 1,
                GridSpanY           = 2,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Text = "This is 2 rows button"
            };

            button2.Down += (s, a) =>
            {
                var messageBox = Dialog.CreateMessageBox("2R", "2 Rows Button pushed!");
                messageBox.ShowModal(_host);
            };
            grid.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,
                WidthHint  = 200,
                HeightHint = 200
            };

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

            var button3 = new Button
            {
                Text          = "Show Window",
                GridPositionX = 4,
                GridPositionY = 3
            };

            grid.Widgets.Add(button3);

            button3.Up += (sender, args) =>
            {
                _window.ShowModal(_host);
            };

            // Horizontal slider
            var hslider = new HorizontalSlider
            {
                GridPositionX = 3,
                GridPositionY = 2
            };

            grid.Widgets.Add(hslider);

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

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

            grid.Widgets.Add(hsliderValue);

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

            grid.Widgets.Add(textBlock);

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

            grid.Widgets.Add(checkBox);

            // Spin buttons
            var textField = new TextField
            {
                GridPositionX = 5,
                GridPositionY = 1,
                WidthHint     = 100
            };

            grid.Widgets.Add(textField);

            var spinButton2 = new SpinButton
            {
                GridPositionX = 5,
                GridPositionY = 2,
                WidthHint     = 100,
                Integer       = true
            };

            grid.Widgets.Add(spinButton2);

            // Progress bars
            _horizontalProgressBar = new HorizontalProgressBar
            {
                GridPositionX = 5,
                GridPositionY = 3,
                WidthHint     = 100
            };
            grid.Widgets.Add(_horizontalProgressBar);

            _verticalProgressBar = new VerticalProgressBar
            {
                GridPositionX = 6,
                GridPositionY = 1,
                HeightHint    = 100
            };
            grid.Widgets.Add(_verticalProgressBar);

            // List box
            var list = new ListBox
            {
                GridPositionX = 5,
                GridPositionY = 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));
            grid.Widgets.Add(list);

            // Vertical slider
            var vslider = new VerticalSlider
            {
                GridPositionX = 2,
                GridPositionY = 4
            };

            grid.Widgets.Add(vslider);

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

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

            grid.Widgets.Add(vsliderValue);

            var tree = new Tree
            {
                HasRoot       = false,
                GridPositionX = 3,
                GridPositionY = 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");

            grid.Widgets.Add(tree);

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

            grid.Widgets.Add(textBlock2);

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

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

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

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

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

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

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

                grid.Widgets.Add(header);
            }

            _host.Widgets.Add(grid);
        }
Ejemplo n.º 27
0
        private void BuildUI()
        {
            _menuFileNew      = new MenuItem();
            _menuFileNew.Id   = "_menuFileNew";
            _menuFileNew.Text = "&New";

            _menuFileOpen      = new MenuItem();
            _menuFileOpen.Id   = "_menuFileOpen";
            _menuFileOpen.Text = "&Open";

            _menuFileReload      = new MenuItem();
            _menuFileReload.Id   = "_menuFileReload";
            _menuFileReload.Text = "&Reload";

            _menuFileSave      = new MenuItem();
            _menuFileSave.Id   = "_menuFileSave";
            _menuFileSave.Text = "&Save";

            _menuFileSaveAs      = new MenuItem();
            _menuFileSaveAs.Id   = "_menuFileSaveAs";
            _menuFileSaveAs.Text = "Save &As...";

            _menuFileExportToCS      = new MenuItem();
            _menuFileExportToCS.Id   = "_menuFileExportToCS";
            _menuFileExportToCS.Text = "&Export To C#...";

            var menuSeparator1 = new MenuSeparator();

            _menuFileLoadStylesheet      = new MenuItem();
            _menuFileLoadStylesheet.Id   = "_menuFileLoadStylesheet";
            _menuFileLoadStylesheet.Text = "&Load Stylesheet";

            _menuFileReloadStylesheet      = new MenuItem();
            _menuFileReloadStylesheet.Id   = "_menuFileReloadStylesheet";
            _menuFileReloadStylesheet.Text = "Rel&oad Stylesheet";

            _menuFileResetStylesheet      = new MenuItem();
            _menuFileResetStylesheet.Id   = "_menuFileResetStylesheet";
            _menuFileResetStylesheet.Text = "Rese&t Stylesheet";

            var menuSeparator2 = new MenuSeparator();

            _menuFileDebugOptions      = new MenuItem();
            _menuFileDebugOptions.Id   = "_menuFileDebugOptions";
            _menuFileDebugOptions.Text = "&UI Debug Options";

            var menuSeparator3 = new MenuSeparator();

            _menuFileQuit      = new MenuItem();
            _menuFileQuit.Id   = "_menuFileQuit";
            _menuFileQuit.Text = "&Quit";

            var menuItem1 = new MenuItem();

            menuItem1.Id   = "";
            menuItem1.Text = "&File";
            menuItem1.Items.Add(_menuFileNew);
            menuItem1.Items.Add(_menuFileOpen);
            menuItem1.Items.Add(_menuFileReload);
            menuItem1.Items.Add(_menuFileSave);
            menuItem1.Items.Add(_menuFileSaveAs);
            menuItem1.Items.Add(_menuFileExportToCS);
            menuItem1.Items.Add(menuSeparator1);
            menuItem1.Items.Add(_menuFileLoadStylesheet);
            menuItem1.Items.Add(_menuFileReloadStylesheet);
            menuItem1.Items.Add(_menuFileResetStylesheet);
            menuItem1.Items.Add(menuSeparator2);
            menuItem1.Items.Add(_menuFileDebugOptions);
            menuItem1.Items.Add(menuSeparator3);
            menuItem1.Items.Add(_menuFileQuit);

            _menuControlsAddButton      = new MenuItem();
            _menuControlsAddButton.Id   = "_menuControlsAddButton";
            _menuControlsAddButton.Text = "Add Button";

            _menuControlsAddCheckBox      = new MenuItem();
            _menuControlsAddCheckBox.Id   = "_menuControlsAddCheckBox";
            _menuControlsAddCheckBox.Text = "Add CheckBox";

            _menuControlsAddRadioButton      = new MenuItem();
            _menuControlsAddRadioButton.Id   = "_menuControlsAddRadioButton";
            _menuControlsAddRadioButton.Text = "Add RadioButton";

            _menuControlsAddImageButton      = new MenuItem();
            _menuControlsAddImageButton.Id   = "_menuControlsAddImageButton";
            _menuControlsAddImageButton.Text = "Add ImageButton";

            _menuControlsAddTextButton      = new MenuItem();
            _menuControlsAddTextButton.Id   = "_menuControlsAddTextButton";
            _menuControlsAddTextButton.Text = "Add TextButton";

            _menuControlsAddHorizontalSlider      = new MenuItem();
            _menuControlsAddHorizontalSlider.Id   = "_menuControlsAddHorizontalSlider";
            _menuControlsAddHorizontalSlider.Text = "Add Horizontal Slider";

            _menuControlsAddVerticalSlider      = new MenuItem();
            _menuControlsAddVerticalSlider.Id   = "_menuControlsAddVerticalSlider";
            _menuControlsAddVerticalSlider.Text = "Add Vertical Slider";

            _menuControlsAddHorizontalProgressBar      = new MenuItem();
            _menuControlsAddHorizontalProgressBar.Id   = "_menuControlsAddHorizontalProgressBar";
            _menuControlsAddHorizontalProgressBar.Text = "Add Horizontal ProgressBar";

            _menuControlsAddVerticalProgressBar      = new MenuItem();
            _menuControlsAddVerticalProgressBar.Id   = "_menuControlsAddVerticalProgressBar";
            _menuControlsAddVerticalProgressBar.Text = "Add Vertical ProgressBar";

            _menuControlsAddHorizontalSeparator      = new MenuItem();
            _menuControlsAddHorizontalSeparator.Id   = "_menuControlsAddHorizontalSeparator";
            _menuControlsAddHorizontalSeparator.Text = "Add Horizontal Separator";

            _menuControlsAddVerticalSeparator      = new MenuItem();
            _menuControlsAddVerticalSeparator.Id   = "_menuControlsAddVerticalSeparator";
            _menuControlsAddVerticalSeparator.Text = "Add Vertical Separator";

            _menuControlsAddComboBox      = new MenuItem();
            _menuControlsAddComboBox.Id   = "_menuControlsAddComboBox";
            _menuControlsAddComboBox.Text = "Add ComboBox";

            _menuControlsAddListBox      = new MenuItem();
            _menuControlsAddListBox.Id   = "_menuControlsAddListBox";
            _menuControlsAddListBox.Text = "Add ListBox";

            _menuControlsAddTabControl      = new MenuItem();
            _menuControlsAddTabControl.Id   = "_menuControlsAddTabControl";
            _menuControlsAddTabControl.Text = "Add TabControl";

            _menuControlsAddImage      = new MenuItem();
            _menuControlsAddImage.Id   = "_menuControlsAddImage";
            _menuControlsAddImage.Text = "Add Image";

            _menuControlsAddTextBlock      = new MenuItem();
            _menuControlsAddTextBlock.Id   = "_menuControlsAddTextBlock";
            _menuControlsAddTextBlock.Text = "Add TextBlock";

            _menuControlsAddTextField      = new MenuItem();
            _menuControlsAddTextField.Id   = "_menuControlsAddTextField";
            _menuControlsAddTextField.Text = "Add TextField";

            _menuControlsAddSpinButton      = new MenuItem();
            _menuControlsAddSpinButton.Id   = "_menuControlsAddSpinButton";
            _menuControlsAddSpinButton.Text = "Add SpinButton";

            var menuSeparator4 = new MenuSeparator();

            _menuControlsAddPanel      = new MenuItem();
            _menuControlsAddPanel.Id   = "_menuControlsAddPanel";
            _menuControlsAddPanel.Text = "Add Panel";

            _menuControlsAddGrid      = new MenuItem();
            _menuControlsAddGrid.Id   = "_menuControlsAddGrid";
            _menuControlsAddGrid.Text = "Add Grid";

            _menuControlsAddScrollPane      = new MenuItem();
            _menuControlsAddScrollPane.Id   = "_menuControlsAddScrollPane";
            _menuControlsAddScrollPane.Text = "Add ScrollPane";

            _menuControlsAddHorizontalSplitPane      = new MenuItem();
            _menuControlsAddHorizontalSplitPane.Id   = "_menuControlsAddHorizontalSplitPane";
            _menuControlsAddHorizontalSplitPane.Text = "Add Horizontal SplitPane";

            _menuControlsAddVerticalSplitPane      = new MenuItem();
            _menuControlsAddVerticalSplitPane.Id   = "_menuControlsAddVerticalSplitPane";
            _menuControlsAddVerticalSplitPane.Text = "Add Vertical SplitPane";

            _menuControlsAddWindow      = new MenuItem();
            _menuControlsAddWindow.Id   = "_menuControlsAddWindow";
            _menuControlsAddWindow.Text = "Add Window";

            _menuControlsAddDialog      = new MenuItem();
            _menuControlsAddDialog.Id   = "_menuControlsAddDialog";
            _menuControlsAddDialog.Text = "Add Dialog";

            var menuSeparator5 = new MenuSeparator();

            _menuControlsAddHorizontalMenu      = new MenuItem();
            _menuControlsAddHorizontalMenu.Id   = "_menuControlsAddHorizontalMenu";
            _menuControlsAddHorizontalMenu.Text = "Add HorizontalMenu";

            _menuControlsAddVerticalMenu      = new MenuItem();
            _menuControlsAddVerticalMenu.Id   = "_menuControlsAddVerticalMenu";
            _menuControlsAddVerticalMenu.Text = "Add Vertical Menu";

            _menuControlsAddMenuItem      = new MenuItem();
            _menuControlsAddMenuItem.Id   = "_menuControlsAddMenuItem";
            _menuControlsAddMenuItem.Text = "Add Menu Item";

            _menuControlsAddMenuSeparator      = new MenuItem();
            _menuControlsAddMenuSeparator.Id   = "_menuControlsAddMenuSeparator";
            _menuControlsAddMenuSeparator.Text = "Add Menu Separator";

            _menuControls      = new MenuItem();
            _menuControls.Id   = "_menuControls";
            _menuControls.Text = "&Controls";
            _menuControls.Items.Add(_menuControlsAddButton);
            _menuControls.Items.Add(_menuControlsAddCheckBox);
            _menuControls.Items.Add(_menuControlsAddRadioButton);
            _menuControls.Items.Add(_menuControlsAddImageButton);
            _menuControls.Items.Add(_menuControlsAddTextButton);
            _menuControls.Items.Add(_menuControlsAddHorizontalSlider);
            _menuControls.Items.Add(_menuControlsAddVerticalSlider);
            _menuControls.Items.Add(_menuControlsAddHorizontalProgressBar);
            _menuControls.Items.Add(_menuControlsAddVerticalProgressBar);
            _menuControls.Items.Add(_menuControlsAddHorizontalSeparator);
            _menuControls.Items.Add(_menuControlsAddVerticalSeparator);
            _menuControls.Items.Add(_menuControlsAddComboBox);
            _menuControls.Items.Add(_menuControlsAddListBox);
            _menuControls.Items.Add(_menuControlsAddTabControl);
            _menuControls.Items.Add(_menuControlsAddImage);
            _menuControls.Items.Add(_menuControlsAddTextBlock);
            _menuControls.Items.Add(_menuControlsAddTextField);
            _menuControls.Items.Add(_menuControlsAddSpinButton);
            _menuControls.Items.Add(menuSeparator4);
            _menuControls.Items.Add(_menuControlsAddPanel);
            _menuControls.Items.Add(_menuControlsAddGrid);
            _menuControls.Items.Add(_menuControlsAddScrollPane);
            _menuControls.Items.Add(_menuControlsAddHorizontalSplitPane);
            _menuControls.Items.Add(_menuControlsAddVerticalSplitPane);
            _menuControls.Items.Add(_menuControlsAddWindow);
            _menuControls.Items.Add(_menuControlsAddDialog);
            _menuControls.Items.Add(menuSeparator5);
            _menuControls.Items.Add(_menuControlsAddHorizontalMenu);
            _menuControls.Items.Add(_menuControlsAddVerticalMenu);
            _menuControls.Items.Add(_menuControlsAddMenuItem);
            _menuControls.Items.Add(_menuControlsAddMenuSeparator);

            _menuHelpAbout      = new MenuItem();
            _menuHelpAbout.Id   = "_menuHelpAbout";
            _menuHelpAbout.Text = "&About";

            var menuItem2 = new MenuItem();

            menuItem2.Id   = "";
            menuItem2.Text = "&Help";
            menuItem2.Items.Add(_menuHelpAbout);

            var horizontalMenu1 = new HorizontalMenu();

            horizontalMenu1.Id = "";
            horizontalMenu1.Items.Add(menuItem1);
            horizontalMenu1.Items.Add(_menuControls);
            horizontalMenu1.Items.Add(menuItem2);

            _projectHolder    = new Panel();
            _projectHolder.Id = "_projectHolder";

            _explorerHolder    = new Panel();
            _explorerHolder.Id = "_explorerHolder";

            _propertyGridPane         = new ScrollPane();
            _propertyGridPane.Child   = null;
            _propertyGridPane.Id      = "_propertyGridPane";
            _propertyGridPane.GridRow = 2;

            _rightSplitPane            = new VerticalSplitPane();
            _rightSplitPane.Id         = "_rightSplitPane";
            _rightSplitPane.GridColumn = 2;
            _rightSplitPane.Widgets.Add(_explorerHolder);
            _rightSplitPane.Widgets.Add(_propertyGridPane);

            _topSplitPane         = new HorizontalSplitPane();
            _topSplitPane.Id      = "_topSplitPane";
            _topSplitPane.GridRow = 1;
            _topSplitPane.Widgets.Add(_projectHolder);
            _topSplitPane.Widgets.Add(_rightSplitPane);


            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            Id = "Root";
            Widgets.Add(horizontalMenu1);
            Widgets.Add(_topSplitPane);
        }