private void BuildUI()
        {
            _tagTextBox = new TextBox();
            _tagTextBox.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _tagTextBox.MinWidth            = 150;
            _tagTextBox.Id = "_tagTextBox";

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

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

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

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

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


            ColumnSpacing = 8;
            RowSpacing    = 8;
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            BorderThickness = new Thickness(8);
            Widgets.Add(_tagTextBox);
            Widgets.Add(_setTagButton);
            Widgets.Add(_addComponentButton);
            Widgets.Add(_removeComponentButton);
            Widgets.Add(_deleteEntityButton);
            Widgets.Add(_addChildButton);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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.Height  = 4;
            horizontalSeparator1.GridRow = 1;

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

            var scrollPane1 = new ScrollPane();

            scrollPane1.GridRow = 2;
            scrollPane1.Child   = 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);
        }
Esempio n. 4
0
 protected void RegisterWidget(Widget widget)
 {
     Widgets.Add(widget);
 }
Esempio n. 5
0
        private void BuildUI()
        {
            var label1 = new Label();

            label1.Text = "Inputs";

            var label2 = new Label();

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

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

            var scrollViewer1 = new ScrollViewer();

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

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

            var scrollViewer2 = new ScrollViewer();

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

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

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

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

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


            ShowGridLines = true;
            ColumnSpacing = 8;
            RowSpacing    = 8;
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            Widgets.Add(label1);
            Widgets.Add(label2);
            Widgets.Add(scrollViewer1);
            Widgets.Add(scrollViewer2);
            Widgets.Add(_removeSelectedInput);
            Widgets.Add(_removeSelectedOutput);
            Widgets.Add(_addInputButton);
            Widgets.Add(_addOutputButton);
        }
Esempio n. 6
0
 public void AddWidget(Widget widget)
 {
     Widgets.Add(widget);
 }
Esempio n. 7
0
        private void Rebuild()
        {
            RowsProportions.Clear();
            Widgets.Clear();
            _records.Clear();

            if (_object == null)
            {
                return;
            }

            var properties = from p in _object.GetType().GetProperties() select p;
            var records    = new List <Record>();

            foreach (var property in properties)
            {
                if (property.GetGetMethod() == null ||
                    !property.GetGetMethod().IsPublic ||
                    property.GetGetMethod().IsStatic)
                {
                    continue;
                }

                var hasSetter = property.GetSetMethod() != null &&
                                property.GetSetMethod().IsPublic;

                var browsableAttr = property.FindAttribute <BrowsableAttribute>();
                if (browsableAttr != null && !browsableAttr.Browsable)
                {
                    continue;
                }

                var hiddenAttr = property.FindAttribute <HiddenInEditorAttribute>();
                if (hiddenAttr != null)
                {
                    continue;
                }

                var readOnlyAttr = property.FindAttribute <ReadOnlyAttribute>();
                if (readOnlyAttr != null && readOnlyAttr.IsReadOnly)
                {
                    hasSetter = false;
                }

                var record = new PropertyRecord(property)
                {
                    HasSetter = hasSetter
                };

                var selectionAttr = property.FindAttribute <SelectionAttribute>();
                if (selectionAttr != null)
                {
                    record.ItemsProvider = (IItemsProvider)Activator.CreateInstance(selectionAttr.ItemsProviderType, _object);
                }

                var categoryAttr = property.FindAttribute <EditCategoryAttribute>();
                record.Category = categoryAttr != null ? categoryAttr.Name : DefaultCategoryName;

                records.Add(record);
            }

            var fields = from f in _object.GetType().GetFields() select f;

            foreach (var field in fields)
            {
                if (!field.IsPublic || field.IsStatic)
                {
                    continue;
                }

                var categoryAttr = field.FindAttribute <EditCategoryAttribute>();


                var hasSetter    = true;
                var readOnlyAttr = field.FindAttribute <ReadOnlyAttribute>();
                if (readOnlyAttr != null && readOnlyAttr.IsReadOnly)
                {
                    hasSetter = false;
                }


                var record = new FieldRecord(field)
                {
                    HasSetter = hasSetter,
                    Category  = categoryAttr != null ? categoryAttr.Name : DefaultCategoryName
                };

                records.Add(record);
            }

            // Sort by categories
            for (var i = 0; i < records.Count; ++i)
            {
                var record = records[i];

                List <Record> categoryRecords;
                if (!_records.TryGetValue(record.Category, out categoryRecords))
                {
                    categoryRecords           = new List <Record>();
                    _records[record.Category] = categoryRecords;
                }

                categoryRecords.Add(record);
            }

            // Sort by names within categories
            foreach (var category in _records)
            {
                category.Value.Sort((a, b) => Comparer <string> .Default.Compare(a.Name, b.Name));
            }

            var ordered = _records.OrderBy(key => key.Key);

            var           y = 0;
            List <Record> defaultCategoryRecords;


            if (_records.TryGetValue(Category, out defaultCategoryRecords))
            {
                FillSubGrid(ref y, defaultCategoryRecords);
            }

            if (Category != DefaultCategoryName)
            {
                return;
            }

            foreach (var category in ordered)
            {
                if (category.Key == DefaultCategoryName)
                {
                    continue;
                }

                var subGrid = new SubGrid(this, Object, category.Key, category.Key, null)
                {
                    GridSpanX     = 2,
                    GridPositionY = y
                };

                Widgets.Add(subGrid);

                if (_expandedCategories.Contains(category.Key))
                {
                    subGrid.Mark.IsPressed = true;
                }

                var rp = new Proportion(ProportionType.Auto);
                RowsProportions.Add(rp);

                y++;
            }
        }
        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 ImageTextButton();
            _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 ImageTextButton();
            _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 ImageTextButton("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.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);
        }
Esempio n. 9
0
        private void BuildUI()
        {
            var textBlock1 = new TextBlock();

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

            _button              = new Button();
            _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.SelectedIndex = 1;
            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.Child = _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);
        }
Esempio n. 10
0
        private void BuildUI()
        {
            _textPath          = new TextBox();
            _textPath.Text     = "";
            _textPath.Readonly = true;
            _textPath.Id       = "_textPath";
            _textPath.Width    = 300;

            _buttonChange            = new TextButton();
            _buttonChange.Text       = "Change...";
            _buttonChange.Id         = "_buttonChange";
            _buttonChange.GridColumn = 1;

            var listItem1 = new ListItem();

            listItem1.Id   = null;
            listItem1.Text = "model1.g3dj";

            var listItem2 = new ListItem();

            listItem2.Id   = null;
            listItem2.Text = "another_model.g3db";

            var listItem3 = new ListItem();

            listItem3.Id   = null;
            listItem3.Text = "tree.g3dj";

            _listFiles        = new ListBox();
            _listFiles.Id     = "_listFiles";
            _listFiles.Height = 200;
            _listFiles.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _listFiles.GridRow             = 1;
            _listFiles.Items.Add(listItem1);
            _listFiles.Items.Add(listItem2);
            _listFiles.Items.Add(listItem3);

            var listItem4 = new ListItem();

            listItem4.Id = null;

            var listItem5 = new ListItem();

            listItem5.Id   = null;
            listItem5.Text = "Move";

            var listItem6 = new ListItem();

            listItem6.Id   = null;
            listItem6.Text = "Attack";

            _comboAnimations    = new ComboBox();
            _comboAnimations.Id = "_comboAnimations";
            _comboAnimations.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _comboAnimations.GridRow             = 2;
            _comboAnimations.Items.Add(listItem4);
            _comboAnimations.Items.Add(listItem5);
            _comboAnimations.Items.Add(listItem6);

            _checkLightning         = new CheckBox();
            _checkLightning.Text    = "Lightning On";
            _checkLightning.Id      = "_checkLightning";
            _checkLightning.GridRow = 3;

            var grid1 = new Grid();

            grid1.ColumnSpacing           = 8;
            grid1.RowSpacing              = 8;
            grid1.DefaultColumnProportion = new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            };
            grid1.DefaultRowProportion = new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            };
            grid1.Widgets.Add(_textPath);
            grid1.Widgets.Add(_buttonChange);
            grid1.Widgets.Add(_listFiles);
            grid1.Widgets.Add(_comboAnimations);
            grid1.Widgets.Add(_checkLightning);

            _labelFps      = new Label();
            _labelFps.Text = "FPS: 60.0";
            _labelFps.Id   = "_labelFps";

            _labelMeshes      = new Label();
            _labelMeshes.Text = "Meshes: 15";
            _labelMeshes.Id   = "_labelMeshes";

            _labelCamera      = new Label();
            _labelCamera.Text = "Camera: 0/50/0;270;0";
            _labelCamera.Id   = "_labelCamera";

            var verticalStackPanel1 = new VerticalStackPanel();

            verticalStackPanel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Right;
            verticalStackPanel1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Bottom;
            verticalStackPanel1.Widgets.Add(_labelFps);
            verticalStackPanel1.Widgets.Add(_labelMeshes);
            verticalStackPanel1.Widgets.Add(_labelCamera);


            Widgets.Add(grid1);
            Widgets.Add(verticalStackPanel1);
        }
Esempio n. 11
0
        public override void Deserialize(Version documentVersion, System.Xml.XmlElement node)
        {
            base.Deserialize(documentVersion, node);

            Hyperlink = node.GetAttribute("hyperlink");
            Folded    = ST.GetBoolDefault(node.GetAttribute("folded"));

            //
            if (documentVersion >= Document.DV_3) // 新
            {
                CustomWidth  = ST.GetInt(node.GetAttribute("custom_width"));
                CustomHeight = ST.GetInt(node.GetAttribute("custom_height"));
            }
            else
            {
                CustomWidth  = ST.GetInt(node.GetAttribute("width"));
                CustomHeight = ST.GetInt(node.GetAttribute("height"));
            }

            TextBounds       = ST.GetRectangle(node.GetAttribute("text_b"), TextBounds);
            RemarkIconBounds = ST.GetRectangle(node.GetAttribute("remark_b"), RemarkIconBounds);
            FoldingButton    = ST.GetRectangle(node.GetAttribute("fold_btn_b"), FoldingButton);

            XmlElement styleNode = node.SelectSingleNode("style") as XmlElement;

            if (styleNode != null)
            {
                Style.Deserialize(documentVersion, styleNode);
            }

            //
            var linkNodes = node.SelectNodes("links/link");

            foreach (XmlElement linkNode in linkNodes)
            {
                Link link = new Link();
                link.Deserialize(documentVersion, linkNode);
                Links.Add(link);
            }

            //
            var widgetNodes = node.SelectNodes("widgets/widget");

            foreach (XmlElement widgetNode in widgetNodes)
            {
                var widget = Widget.DeserializeWidget(documentVersion, widgetNode);
                if (widget != null)
                {
                    Widgets.Add(widget);
                }
            }

            //
            XmlNodeList nodes = node.SelectNodes("nodes/node");

            foreach (XmlElement subNode in nodes)
            {
                Topic subTopic = new Topic();
                subTopic.Deserialize(documentVersion, subNode);
                Children.Add(subTopic);
            }

            //
            if (!Children.IsNullOrEmpty())
            {
                XmlNodeList lines = node.SelectNodes("lines/line");
                foreach (XmlElement lineNode in lines)
                {
                    var line = new TopicLine();
                    line.Deserialize(documentVersion, lineNode);

                    var targetID = lineNode.GetAttribute("target");
                    var target   = Children.Find(c => StringComparer.OrdinalIgnoreCase.Equals(c.ID, targetID));
                    if (target != null)
                    {
                        line.SetTarget(target);
                        Lines.Add(line);
                    }
                }
            }

            //
        }
Esempio n. 12
0
        private void BuildUI()
        {
            _menuItemQuit      = new MenuItem();
            _menuItemQuit.Id   = "_menuItemQuit";
            _menuItemQuit.Text = "&Quit";

            var menuItem1 = new MenuItem();

            menuItem1.Id   = "";
            menuItem1.Text = "&File";
            menuItem1.Items.Add(_menuItemQuit);

            _menuItemAddModel      = new MenuItem();
            _menuItemAddModel.Id   = "_menuItemAddModel";
            _menuItemAddModel.Text = "&Model";

            _menuItemAddSkybox      = new MenuItem();
            _menuItemAddSkybox.Id   = "_menuItemAddSkybox";
            _menuItemAddSkybox.Text = "&Skybox";

            _menuItemAddTerrain      = new MenuItem();
            _menuItemAddTerrain.Id   = "_menuItemAddTerrain";
            _menuItemAddTerrain.Text = "&Terrain";

            _menuItemAddWater      = new MenuItem();
            _menuItemAddWater.Id   = "_menuItemAddWater";
            _menuItemAddWater.Text = "&Water";

            var menuItem2 = new MenuItem();

            menuItem2.Id   = "";
            menuItem2.Text = "&Items";
            menuItem2.Items.Add(_menuItemAddModel);
            menuItem2.Items.Add(_menuItemAddSkybox);
            menuItem2.Items.Add(_menuItemAddTerrain);
            menuItem2.Items.Add(_menuItemAddWater);

            _menuItemShowGrid      = new MenuItem();
            _menuItemShowGrid.Id   = "_menuItemShowGrid";
            _menuItemShowGrid.Text = "&Grid";

            _menuItemLockFps      = new MenuItem();
            _menuItemLockFps.Id   = "_menuItemLockFps";
            _menuItemLockFps.Text = "&Lock FPS at 60";

            var menuItem3 = new MenuItem();

            menuItem3.Id   = "";
            menuItem3.Text = "&Options";
            menuItem3.Items.Add(_menuItemShowGrid);
            menuItem3.Items.Add(_menuItemLockFps);

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

            var menuItem4 = new MenuItem();

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

            var horizontalMenu1 = new HorizontalMenu();

            horizontalMenu1.Items.Add(menuItem1);
            horizontalMenu1.Items.Add(menuItem2);
            horizontalMenu1.Items.Add(menuItem3);
            horizontalMenu1.Items.Add(menuItem4);

            var listItem1 = new ListItem();

            listItem1.Id   = "";
            listItem1.Text = "Directional Light (#_sun)";

            var listItem2 = new ListItem();

            listItem2.Id   = null;
            listItem2.Text = "Camera (#_mainCamera)";

            var listItem3 = new ListItem();

            listItem3.Id   = null;
            listItem3.Text = "Terrain (#_terrain)";

            var listItem4 = new ListItem();

            listItem4.Id   = null;
            listItem4.Text = "Water (#_water)";

            _listExplorer    = new ListBox();
            _listExplorer.Id = "_listExplorer";
            _listExplorer.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _listExplorer.Items.Add(listItem1);
            _listExplorer.Items.Add(listItem2);
            _listExplorer.Items.Add(listItem3);
            _listExplorer.Items.Add(listItem4);

            _panelScene            = new Panel();
            _panelScene.Id         = "_panelScene";
            _panelScene.GridColumn = 2;

            _panelProperties            = new Panel();
            _panelProperties.Id         = "_panelProperties";
            _panelProperties.GridColumn = 4;

            _topSplitPane    = new HorizontalSplitPane();
            _topSplitPane.Id = "_topSplitPane";
            _topSplitPane.Widgets.Add(_listExplorer);
            _topSplitPane.Widgets.Add(_panelScene);
            _topSplitPane.Widgets.Add(_panelProperties);

            _labelFps      = new TextBlock();
            _labelFps.Text = "FPS: 60.0";
            _labelFps.Id   = "_labelFps";

            _labelMeshes         = new TextBlock();
            _labelMeshes.Text    = "Meshes: 15";
            _labelMeshes.Id      = "_labelMeshes";
            _labelMeshes.GridRow = 1;

            _labelCamera         = new TextBlock();
            _labelCamera.Text    = "Camera: 0/50/0;270;0";
            _labelCamera.Id      = "_labelCamera";
            _labelCamera.GridRow = 2;

            var grid1 = new Grid();

            grid1.ColumnsProportions.Add(new Grid.Proportion());
            grid1.ColumnsProportions.Add(new Grid.Proportion());
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Right;
            grid1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Bottom;
            grid1.Widgets.Add(_labelFps);
            grid1.Widgets.Add(_labelMeshes);
            grid1.Widgets.Add(_labelCamera);

            var panel1 = new Panel();

            panel1.GridRow = 1;
            panel1.Widgets.Add(_topSplitPane);
            panel1.Widgets.Add(grid1);


            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            Widgets.Add(horizontalMenu1);
            Widgets.Add(panel1);
        }
Esempio n. 13
0
        private void BuildUI()
        {
            var label1 = new Label();

            label1.Text = "Game Screen";
            label1.Top  = 100;
            label1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;

            var radioButton1 = new RadioButton();

            radioButton1.Text = "Radio 1";

            var radioButton2 = new RadioButton();

            radioButton2.Text = "Radio 2";

            var radioButton3 = new RadioButton();

            radioButton3.Text = "Radio 3";

            var radioButton4 = new RadioButton();

            radioButton4.Text = "Radio 4";

            var horizontalStackPanel1 = new HorizontalStackPanel();

            horizontalStackPanel1.Top = 50;
            horizontalStackPanel1.Widgets.Add(radioButton1);
            horizontalStackPanel1.Widgets.Add(radioButton2);
            horizontalStackPanel1.Widgets.Add(radioButton3);
            horizontalStackPanel1.Widgets.Add(radioButton4);

            var textButton1 = new TextButton();

            textButton1.Text = "Button 1";

            var textButton2 = new TextButton();

            textButton2.Text = "Button 2";

            var textButton3 = new TextButton();

            textButton3.Text = "Button 3";

            var textButton4 = new TextButton();

            textButton4.Text = "Button 4";

            var horizontalStackPanel2 = new HorizontalStackPanel();

            horizontalStackPanel2.Spacing = 8;
            horizontalStackPanel2.Top     = 300;
            horizontalStackPanel2.Widgets.Add(textButton1);
            horizontalStackPanel2.Widgets.Add(textButton2);
            horizontalStackPanel2.Widgets.Add(textButton3);
            horizontalStackPanel2.Widgets.Add(textButton4);

            _buttonDebugPanel      = new TextButton();
            _buttonDebugPanel.Text = "Show Debug Panel";
            _buttonDebugPanel.Id   = "_buttonDebugPanel";

            _buttonModalDebugPanel      = new TextButton();
            _buttonModalDebugPanel.Text = "Show Debug Panel Modal";
            _buttonModalDebugPanel.Id   = "_buttonModalDebugPanel";

            var horizontalStackPanel3 = new HorizontalStackPanel();

            horizontalStackPanel3.Spacing           = 8;
            horizontalStackPanel3.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Bottom;
            horizontalStackPanel3.Widgets.Add(_buttonDebugPanel);
            horizontalStackPanel3.Widgets.Add(_buttonModalDebugPanel);


            Widgets.Add(label1);
            Widgets.Add(horizontalStackPanel1);
            Widgets.Add(horizontalStackPanel2);
            Widgets.Add(horizontalStackPanel3);
        }
        private void BuildUI()
        {
            var textBlock1 = new TextBlock();

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

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

            var textBlock2 = new TextBlock();

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

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

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

            var textBlock3 = new TextBlock();

            textBlock3.Text = "Namespace:";

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


            ColumnSpacing = 8;
            RowSpacing    = 8;
            ColumnsProportions.Add(new Grid.Proportion());
            ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            ColumnsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            RowsProportions.Add(new Grid.Proportion());
            Id    = "Root";
            Width = 800;
            Widgets.Add(textBlock1);
            Widgets.Add(_textClassName);
            Widgets.Add(textBlock2);
            Widgets.Add(_textOutputPath);
            Widgets.Add(_buttonChangeOutputPath);
            Widgets.Add(textBlock3);
            Widgets.Add(_textNamespace);
        }
Esempio n. 15
0
 /// <summary>
 /// Attach a widget to this console
 /// </summary>
 /// <param name="widget">The widget to attach </param>
 public void AttachWidget(Widget widget)
 {
     Widgets.Add(widget);
     widget.Parent = this;
 }
Esempio n. 16
0
        private void BuildUI()
        {
            var menuItem1 = new MenuItem();

            menuItem1.Text = "Add &Orc";

            var menuItem2 = new MenuItem();

            menuItem2.Text = "Add &Peasant";

            var menuItem3 = new MenuItem();

            menuItem3.Text = "Add &Knight";

            var menuItem4 = new MenuItem();

            menuItem4.Text = "Add &Priest";

            var menuItem5 = new MenuItem();

            menuItem5.Text = "Add &Wizard";

            var menuItem6 = new MenuItem();

            menuItem6.Text = "&Units";
            menuItem6.Items.Add(menuItem1);
            menuItem6.Items.Add(menuItem2);
            menuItem6.Items.Add(menuItem3);
            menuItem6.Items.Add(menuItem4);
            menuItem6.Items.Add(menuItem5);

            var menuItem7 = new MenuItem();

            menuItem7.Text = "Add 10000 &Gold";

            var menuItem8 = new MenuItem();

            menuItem8.Text = "Add 10000 &Wood";

            var menuItem9 = new MenuItem();

            menuItem9.Text = "&Operations";
            menuItem9.Items.Add(menuItem7);
            menuItem9.Items.Add(menuItem8);

            var horizontalMenu1 = new HorizontalMenu();

            horizontalMenu1.Items.Add(menuItem6);
            horizontalMenu1.Items.Add(menuItem9);

            var label1 = new Label();

            label1.Text = "Command:";

            var textBox1 = new TextBox();

            var horizontalStackPanel1 = new HorizontalStackPanel();

            horizontalStackPanel1.Spacing = 8;
            horizontalStackPanel1.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            horizontalStackPanel1.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            horizontalStackPanel1.Widgets.Add(label1);
            horizontalStackPanel1.Widgets.Add(textBox1);

            _buttonHideDebug      = new TextButton();
            _buttonHideDebug.Text = "Hide Debug Panel";
            _buttonHideDebug.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonHideDebug.Id = "_buttonHideDebug";


            Spacing = 8;
            Height  = 300;
            Widgets.Add(horizontalMenu1);
            Widgets.Add(horizontalStackPanel1);
            Widgets.Add(_buttonHideDebug);
        }
Esempio n. 17
0
        private void MapFromTemplate(Page page)
        {
            HasTemplate = true;
            Layout      = page.Template.PageLayout;
            Settings    = page.Template.Settings;
            Access[PageTemplate.UnlinkOperationCode] = Access[(int)PageOperations.Update];
            Access[(int)PageOperations.Update]       = false;
            ICorePrincipal currentPrincipal = HttpContext.Current.CorePrincipal();
            var            widgetService    = ServiceLocator.Current.GetInstance <IWidgetService>();

            foreach (var widget in page.Template.Widgets.OrderBy(wd => wd.OrderNumber))
            {
                var widgetToShow = !widget.Widget.IsPlaceHolder
                                       ? widget
                                       : page.Widgets.Where(pageWidget => pageWidget.TemplateWidgetId == widget.Id).
                                   FirstOrDefault();
                if (widget.Widget.IsPlaceHolder)
                {
                    widgetToShow.PageSection  = widget.PageSection;
                    widgetToShow.ColumnNumber = widget.ColumnNumber;
                }
                PageWidget  widget1    = widgetToShow;
                ICoreWidget coreWidget =
                    widgetToShow.Widget != null?MvcApplication.Widgets.FirstOrDefault(wd => wd.Identifier == widget1.Widget.Identifier) : null;

                bool isWidetEnabled = widgetService.IsWidgetEnable(widget1.Widget);
                var  widgetModel    = new WidgetHolderViewModel
                {
                    WidgetInstance = new CoreWidgetInstance
                    {
                        InstanceId       = widgetToShow.InstanceId,
                        WidgetIdentifier =
                            coreWidget != null ? coreWidget.Identifier : null,
                        PageSettings =
                            new CorePageSettings {
                            PageId = page.Template.Id
                        },
                        PageWidgetId = widgetToShow.Id
                    },
                    Widget = widget1,
                    Access = coreWidget is BaseWidget
                                                       ? permissionService.GetAccess(
                        ((BaseWidget)coreWidget).Operations,
                        HttpContext.Current.CorePrincipal(), coreWidget.GetType(),
                        widget1.EntityId,
                        currentPrincipal != null && widget1.User != null &&
                        widget1.User.PrincipalId == currentPrincipal.PrincipalId)
                                                       : null,
                    PageAccess   = Access,
                    SystemWidget = (isWidetEnabled && coreWidget != null) ? coreWidget : null
                };
                if (!widget.Widget.IsPlaceHolder)
                {
                    widgetModel.Access[((BaseWidget)widgetModel.SystemWidget).ManageOperationCode]     = false;
                    widgetModel.Access[((BaseWidget)widgetModel.SystemWidget).PermissionOperationCode] = false;
                }
                Widgets.Add(widgetModel);

                if (coreWidget != null && coreWidget.Plugin != null)
                {
                    if (!PagePlugins.Any(t => t.PluginLocation == coreWidget.Plugin.PluginLocation))
                    {
                        PagePlugins.Add(coreWidget.Plugin);
                    }
                    if (coreWidget is BaseWorkflowWidget)
                    {
                        var workflowWidget = (BaseWorkflowWidget)coreWidget;
                        foreach (var innerPlugin in workflowWidget.InnerPlugins)
                        {
                            ICorePlugin plugin = innerPlugin;
                            if (!PagePlugins.Any(t => t.Identifier == plugin.Identifier))
                            {
                                PagePlugins.Add(plugin);
                            }
                        }
                    }
                }
            }
        }
        private void BuildUI()
        {
            var image1 = new Image();

            image1.Renderable = MyraEnvironment.DefaultAssetManager.Load <TextureRegion>("images/background.jpg");

            drawpile_image                   = new Image();
            drawpile_image.Renderable        = MyraEnvironment.DefaultAssetManager.Load <TextureRegion>("images/cards/back.png");
            drawpile_image.Margin            = new Thickness(15);
            drawpile_image.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
            drawpile_image.Id                = "drawpile_image";

            currentcard_image                     = new Image();
            currentcard_image.Renderable          = MyraEnvironment.DefaultAssetManager.Load <TextureRegion>("images/cards/two_heart.png");
            currentcard_image.Margin              = new Thickness(15);
            currentcard_image.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Right;
            currentcard_image.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            currentcard_image.Id                  = "currentcard_image";

            remainingcardnumber_label                     = new Label();
            remainingcardnumber_label.Text                = "X cartes restantes";
            remainingcardnumber_label.Padding             = new Thickness(5);
            remainingcardnumber_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            remainingcardnumber_label.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            remainingcardnumber_label.Background          = new SolidBrush("#404040FF");
            remainingcardnumber_label.Id                  = "remainingcardnumber_label";

            var panel1 = new Panel();

            panel1.MaxWidth = 0;
            panel1.Widgets.Add(image1);
            panel1.Widgets.Add(drawpile_image);
            panel1.Widgets.Add(currentcard_image);
            panel1.Widgets.Add(remainingcardnumber_label);

            roundname_label                     = new Label();
            roundname_label.Text                = "----- Couleur -----";
            roundname_label.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans48.fnt");
            roundname_label.TextColor           = Color.Black;
            roundname_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            roundname_label.Id                  = "roundname_label";

            rounddesc_label                     = new Label();
            rounddesc_label.Text                = "La prochaine carte est-elle plus grande ou plus petite que ta precedente ?";
            rounddesc_label.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans32.fnt");
            rounddesc_label.Wrap                = true;
            rounddesc_label.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            rounddesc_label.TextColor           = Color.Black;
            rounddesc_label.Top                 = 50;
            rounddesc_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            rounddesc_label.Id                  = "rounddesc_label";

            var label1 = new Label();

            label1.Text              = "A ton tour";
            label1.Font              = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans32.fnt");
            label1.TextColor         = Color.Black;
            label1.Top               = -30;
            label1.Padding           = new Thickness(0, 0, 0, 5);
            label1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Bottom;

            currentplayername_label           = new Label();
            currentplayername_label.Text      = "Guillaume";
            currentplayername_label.Font      = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans48.fnt");
            currentplayername_label.TextColor = Color.Black;
            currentplayername_label.Top       = -30;
            currentplayername_label.Padding   = new Thickness(10, 0, 0, 0);
            currentplayername_label.Id        = "currentplayername_label";

            playerturn_panel = new HorizontalStackPanel();
            playerturn_panel.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            playerturn_panel.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            playerturn_panel.Padding             = new Thickness(0, 0, 0, 20);
            playerturn_panel.Id = "playerturn_panel";
            playerturn_panel.Widgets.Add(label1);
            playerturn_panel.Widgets.Add(currentplayername_label);

            roundchoice_combobox = new ComboBox();
            roundchoice_combobox.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            roundchoice_combobox.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            roundchoice_combobox.Id = "roundchoice_combobox";

            drawcard_button                     = new TextButton();
            drawcard_button.Text                = "Piocher une carte";
            drawcard_button.Top                 = -30;
            drawcard_button.Padding             = new Thickness(5);
            drawcard_button.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            drawcard_button.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Bottom;
            drawcard_button.Id                  = "drawcard_button";

            var panel2 = new Panel();

            panel2.Margin = new Thickness(15);
            panel2.Widgets.Add(roundname_label);
            panel2.Widgets.Add(rounddesc_label);
            panel2.Widgets.Add(playerturn_panel);
            panel2.Widgets.Add(roundchoice_combobox);
            panel2.Widgets.Add(drawcard_button);

            var panel3 = new Panel();

            panel3.Background = new SolidBrush("#FFE2BDFF");
            panel3.Widgets.Add(panel2);

            var horizontalSplitPane1 = new HorizontalSplitPane();

            horizontalSplitPane1.Widgets.Add(panel1);
            horizontalSplitPane1.Widgets.Add(panel3);


            Widgets.Add(horizontalSplitPane1);
        }
Esempio n. 19
0
        private void FillSubGrid(ref int y, IReadOnlyList <Record> records)
        {
            for (var i = 0; i < records.Count; ++i)
            {
                var record = records[i];

                var hasSetter = record.HasSetter;
                if (_parentProperty != null && !_parentProperty.HasSetter)
                {
                    hasSetter = false;
                }

                var    value       = record.GetValue(_object);
                Widget valueWidget = null;

                var oldY = y;

                var propertyType = record.Type;

                Proportion rowProportion;
                if (record.ItemsProvider != null)
                {
                    var values = record.ItemsProvider.Items;

                    var cb = new ComboBox();
                    foreach (var v in values)
                    {
                        cb.Items.Add(new ListItem(v.ToString(), null, v));
                    }


                    cb.SelectedIndex = Array.IndexOf(values, value);
                    if (hasSetter)
                    {
                        cb.SelectedIndexChanged += (sender, args) =>
                        {
                            var item = cb.SelectedItem != null ? values[cb.SelectedIndex] : null;
                            record.SetValue(_object, item);
                            FireChanged(propertyType.Name);
                        };
                    }
                    else
                    {
                        cb.Enabled = false;
                    }

                    valueWidget = cb;
                }
                else if (propertyType == typeof(bool))
                {
                    var isChecked = (bool)value;
                    var cb        = new CheckBox
                    {
                        IsPressed = isChecked
                    };

                    if (hasSetter)
                    {
                        cb.Down += (sender, args) =>
                        {
                            record.SetValue(_object, true);
                            FireChanged(propertyType.Name);
                        };

                        cb.Up += (sender, args) =>
                        {
                            record.SetValue(_object, false);
                            FireChanged(propertyType.Name);
                        };
                    }
                    else
                    {
                        cb.Enabled = false;
                    }

                    valueWidget = cb;
                }
                else if (propertyType == typeof(Color) || propertyType == typeof(Color?))
                {
                    var subGrid = new Grid
                    {
                        ColumnSpacing       = 8,
                        HorizontalAlignment = HorizontalAlignment.Stretch
                    };

                    var isColor = propertyType == typeof(Color);

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

                    var color = Color.Transparent;
                    if (isColor)
                    {
                        color = (Color)value;
                    }
                    else if (value != null)
                    {
                        color = ((Color?)value).Value;
                    }

                    var image = new Image
                    {
                        Drawable          = new Drawable(DefaultAssets.WhiteRegion),
                        VerticalAlignment = VerticalAlignment.Center,
                        WidthHint         = 32,
                        HeightHint        = 16
                    };

                    subGrid.Widgets.Add(image);

                    var button = new Button
                    {
                        Text = "Change...",
                        ContentHorizontalAlignment = HorizontalAlignment.Center,
                        Tag = value,
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        GridPositionX       = 1
                    };

                    subGrid.Widgets.Add(button);

                    if (hasSetter)
                    {
                        button.Up += (sender, args) =>
                        {
                            var dlg = new ColorPickerDialog()
                            {
                                Color = image.Drawable.Color
                            };

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

                                image.Drawable.Color = dlg.Color;
                                record.SetValue(_object, dlg.Color);

                                FireChanged(propertyType.Name);
                            };

                            dlg.ShowModal(Desktop);
                        };
                    }
                    else
                    {
                        button.Enabled = false;
                    }

                    valueWidget = subGrid;
                }
                else if (propertyType.IsAssignableFrom(typeof(Drawable)))
                {
                }
                else if (propertyType.IsEnum)
                {
                    var values = Enum.GetValues(propertyType);

                    var cb = new ComboBox();
                    foreach (var v in values)
                    {
                        cb.Items.Add(new ListItem(v.ToString(), null, v));
                    }

                    cb.SelectedIndex = Array.IndexOf(values, value);

                    if (hasSetter)
                    {
                        cb.SelectedIndexChanged += (sender, args) =>
                        {
                            if (cb.SelectedIndex != -1)
                            {
                                record.SetValue(_object, cb.SelectedIndex);
                                FireChanged(propertyType.Name);
                            }
                        };
                    }
                    else
                    {
                        cb.Enabled = false;
                    }

                    valueWidget = cb;
                }
                else if (propertyType.IsNumericType() ||
                         (propertyType.IsNullablePrimitive() && propertyType.GetNullableType().IsNumericType()))
                {
                    var numericType = propertyType;
                    if (propertyType.IsNullablePrimitive())
                    {
                        numericType = propertyType.GetNullableType();
                    }

                    var spinButton = new SpinButton
                    {
                        Integer  = numericType.IsNumericInteger(),
                        Nullable = propertyType.IsNullablePrimitive(),
                        Value    = value != null ? (float)Convert.ChangeType(value, typeof(float)) : default(float?)
                    };

                    if (hasSetter)
                    {
                        spinButton.ValueChanged += (sender, args) =>
                        {
                            try
                            {
                                object result;

                                if (spinButton.Value != null)
                                {
                                    result = Convert.ChangeType(spinButton.Value.Value, numericType);
                                }
                                else
                                {
                                    result = null;
                                }

                                record.SetValue(_object, result);

                                if (record.Type.IsValueType)
                                {
                                    var tg = this;
                                    var pg = tg._parentGrid;
                                    while (pg != null && tg._parentProperty != null)
                                    {
                                        tg._parentProperty.SetValue(pg._object, tg._object);

                                        if (!tg._parentProperty.Type.IsValueType)
                                        {
                                            break;
                                        }

                                        tg = pg;
                                        pg = tg._parentGrid;
                                    }
                                }

                                FireChanged(record.Name);
                            }
                            catch (Exception)
                            {
                                // TODO: Rework this ugly type conversion solution
                            }
                        };
                    }
                    else
                    {
                        spinButton.Enabled = false;
                    }

                    valueWidget = spinButton;
                }
                else if (propertyType == typeof(string) || propertyType.IsPrimitive || propertyType.IsNullablePrimitive())
                {
                    var tf = new TextField
                    {
                        Text = value != null?value.ToString() : string.Empty
                    };

                    if (hasSetter)
                    {
                        tf.TextChanged += (sender, args) =>
                        {
                            try
                            {
                                object result;

                                if (propertyType.IsNullablePrimitive())
                                {
                                    if (string.IsNullOrEmpty(tf.Text))
                                    {
                                        result = null;
                                    }
                                    else
                                    {
                                        result = Convert.ChangeType(tf.Text, record.Type.GetNullableType());
                                    }
                                }
                                else
                                {
                                    result = Convert.ChangeType(tf.Text, record.Type);
                                }

                                record.SetValue(_object, result);

                                if (record.Type.IsValueType)
                                {
                                    var tg = this;
                                    var pg = tg._parentGrid;
                                    while (pg != null && tg._parentProperty != null)
                                    {
                                        tg._parentProperty.SetValue(pg._object, tg._object);

                                        if (!tg._parentProperty.Type.IsValueType)
                                        {
                                            break;
                                        }

                                        tg = pg;
                                        pg = tg._parentGrid;
                                    }
                                }

                                FireChanged(record.Name);
                            }
                            catch (Exception)
                            {
                                // TODO: Rework this ugly type conversion solution
                            }
                        };
                    }
                    else
                    {
                        tf.Enabled = false;
                    }

                    valueWidget = tf;
                }
                else if (typeof(IList).IsAssignableFrom(propertyType))
                {
                    var it = propertyType.FindGenericType(typeof(ICollection <>));
                    if (it != null)
                    {
                        var itemType = it.GenericTypeArguments[0];
                        if (value != null)
                        {
                            var items = (IList)value;

                            var subGrid = new Grid
                            {
                                ColumnSpacing       = 8,
                                HorizontalAlignment = HorizontalAlignment.Stretch
                            };

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

                            var label = new TextBlock
                            {
                                VerticalAlignment = VerticalAlignment.Center,
                            };
                            UpdateLabelCount(label, items.Count);

                            subGrid.Widgets.Add(label);

                            var button = new Button
                            {
                                Text = "Change...",
                                ContentHorizontalAlignment = HorizontalAlignment.Center,
                                Tag = value,
                                HorizontalAlignment = HorizontalAlignment.Stretch,
                                GridPositionX       = 1
                            };

                            button.Up += (sender, args) =>
                            {
                                var collectionEditor = new CollectionEditor(items, itemType);

                                var dialog = Dialog.CreateMessageBox("Edit", collectionEditor);

                                dialog.ButtonOk.Up += (o, eventArgs) =>
                                {
                                    collectionEditor.SaveChanges();
                                    UpdateLabelCount(label, items.Count);
                                };

                                dialog.ShowModal(Desktop);
                            };

                            subGrid.Widgets.Add(button);
                            valueWidget = subGrid;
                        }
                    }
                }
                else if (!(value is SpriteFont) && !(value is Drawable))
                {
                    // Subgrid
                    if (value != null)
                    {
                        var subGrid = new SubGrid(this, value, record.Name, DefaultCategoryName, record)
                        {
                            GridSpanX     = 2,
                            GridPositionY = y
                        };

                        Widgets.Add(subGrid);

                        rowProportion = new Proportion(ProportionType.Auto);
                        RowsProportions.Add(rowProportion);
                        ++y;

                        continue;
                    }

                    var tb = new TextBlock();
                    tb.ApplyTextBlockStyle(PropertyGridStyle.LabelStyle);
                    tb.Text = "null";

                    valueWidget = tb;
                }

                if (valueWidget == null)
                {
                    continue;
                }

                var nameLabel = new TextBlock
                {
                    Text = record.Name,
                    VerticalAlignment = VerticalAlignment.Center,
                    GridPositionX     = 0,
                    GridPositionY     = oldY
                };

                Widgets.Add(nameLabel);

                valueWidget.GridPositionX       = 1;
                valueWidget.GridPositionY       = oldY;
                valueWidget.HorizontalAlignment = HorizontalAlignment.Stretch;
                valueWidget.VerticalAlignment   = VerticalAlignment.Top;

                Widgets.Add(valueWidget);

                rowProportion = new Proportion(ProportionType.Auto);
                RowsProportions.Add(rowProportion);
                ++y;
            }
        }
Esempio n. 20
0
        private void BuildUI()
        {
            var textBlock1 = new TextBlock();

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

            var listItem1 = new ListItem();

            listItem1.Text = "512x512";

            var listItem2 = new ListItem();

            listItem2.Text = "1024x1024";

            var listItem3 = new ListItem();

            listItem3.Text = "2048x2048";

            var listItem4 = new ListItem();

            listItem4.Text = "4096x4096";

            _comboSize = new ComboBox();
            _comboSize.SelectedIndex       = 2;
            _comboSize.Id                  = "_comboSize";
            _comboSize.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _comboSize.GridPositionX       = 1;
            _comboSize.Items.Add(listItem1);
            _comboSize.Items.Add(listItem2);
            _comboSize.Items.Add(listItem3);
            _comboSize.Items.Add(listItem4);

            var textBlock2 = new TextBlock();

            textBlock2.Text          = "Variability:";
            textBlock2.GridPositionY = 1;

            _spinVariability                     = new SpinButton();
            _spinVariability.Value               = 1;
            _spinVariability.DrawLinesColor      = Color.White;
            _spinVariability.Id                  = "_spinVariability";
            _spinVariability.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _spinVariability.GridPositionX       = 1;
            _spinVariability.GridPositionY       = 1;

            _textWaterLand               = new TextBlock();
            _textWaterLand.Text          = "Water/Land(60%):";
            _textWaterLand.Id            = "_textWaterLand";
            _textWaterLand.GridPositionY = 2;

            _sliderWaterLand                     = new HorizontalSlider();
            _sliderWaterLand.Maximum             = 100;
            _sliderWaterLand.Id                  = "_sliderWaterLand";
            _sliderWaterLand.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _sliderWaterLand.GridPositionX       = 1;
            _sliderWaterLand.GridPositionY       = 2;

            var grid1 = new Grid();

            grid1.DrawLinesColor = Color.White;
            grid1.ColumnSpacing  = 8;
            grid1.RowSpacing     = 8;
            grid1.ColumnsProportions.Add(new Grid.Proportion
            {
                Type  = Myra.Graphics2D.UI.Grid.ProportionType.Pixels,
                Value = 140,
            });
            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());
            grid1.RowsProportions.Add(new Grid.Proportion());
            grid1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid1.Widgets.Add(textBlock1);
            grid1.Widgets.Add(_comboSize);
            grid1.Widgets.Add(textBlock2);
            grid1.Widgets.Add(_spinVariability);
            grid1.Widgets.Add(_textWaterLand);
            grid1.Widgets.Add(_sliderWaterLand);

            _checkSurrondedByWater                            = new CheckBox();
            _checkSurrondedByWater.Text                       = "Surrounded By Water";
            _checkSurrondedByWater.ImageWidthHint             = 10;
            _checkSurrondedByWater.ImageHeightHint            = 10;
            _checkSurrondedByWater.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _checkSurrondedByWater.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _checkSurrondedByWater.Id                         = "_checkSurrondedByWater";
            _checkSurrondedByWater.GridPositionY              = 1;

            _checkSmooth                            = new CheckBox();
            _checkSmooth.Text                       = "Smooth";
            _checkSmooth.ImageWidthHint             = 10;
            _checkSmooth.ImageHeightHint            = 10;
            _checkSmooth.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _checkSmooth.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _checkSmooth.Id                         = "_checkSmooth";
            _checkSmooth.GridPositionY              = 2;

            _checkRemoveSmalIslands                            = new CheckBox();
            _checkRemoveSmalIslands.Text                       = "Remove Small Islands";
            _checkRemoveSmalIslands.ImageWidthHint             = 10;
            _checkRemoveSmalIslands.ImageHeightHint            = 10;
            _checkRemoveSmalIslands.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _checkRemoveSmalIslands.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _checkRemoveSmalIslands.Id                         = "_checkRemoveSmalIslands";
            _checkRemoveSmalIslands.GridPositionY              = 3;

            _checkRemoveSmallLakes                            = new CheckBox();
            _checkRemoveSmallLakes.Text                       = "Remove Small Lakes";
            _checkRemoveSmallLakes.ImageWidthHint             = 10;
            _checkRemoveSmallLakes.ImageHeightHint            = 10;
            _checkRemoveSmallLakes.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _checkRemoveSmallLakes.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _checkRemoveSmallLakes.Id                         = "_checkRemoveSmallLakes";
            _checkRemoveSmallLakes.GridPositionY              = 4;

            _buttonGenerate      = new TextButton();
            _buttonGenerate.Text = "Generate";
            _buttonGenerate.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonGenerate.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonGenerate.Id = "_buttonGenerate";
            _buttonGenerate.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _buttonGenerate.GridPositionY       = 5;

            var textBlock3 = new TextBlock();

            textBlock3.Text = "View Mode:";

            var listItem5 = new ListItem();

            listItem5.Text = "Normal";

            var listItem6 = new ListItem();

            listItem6.Text = "Siluette";

            _comboViewMode = new ComboBox();
            _comboViewMode.SelectedIndex       = 0;
            _comboViewMode.Id                  = "_comboViewMode";
            _comboViewMode.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _comboViewMode.GridPositionX       = 1;
            _comboViewMode.Items.Add(listItem5);
            _comboViewMode.Items.Add(listItem6);

            var grid2 = new Grid();

            grid2.DrawLinesColor = Color.White;
            grid2.ColumnSpacing  = 8;
            grid2.ColumnsProportions.Add(new Grid.Proportion());
            grid2.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid2.RowsProportions.Add(new Grid.Proportion());
            grid2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid2.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid2.GridPositionY       = 6;
            grid2.Widgets.Add(textBlock3);
            grid2.Widgets.Add(_comboViewMode);

            _buttonSaveAsPng      = new TextButton();
            _buttonSaveAsPng.Text = "Save As PNG...";
            _buttonSaveAsPng.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonSaveAsPng.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonSaveAsPng.Id = "_buttonSaveAsPng";
            _buttonSaveAsPng.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _buttonSaveAsPng.GridPositionY       = 7;

            var grid3 = new Grid();

            grid3.DrawLinesColor = Color.White;
            grid3.RowSpacing     = 8;
            grid3.ColumnsProportions.Add(new Grid.Proportion
            {
                Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill,
            });
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.RowsProportions.Add(new Grid.Proportion());
            grid3.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid3.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid3.Widgets.Add(grid1);
            grid3.Widgets.Add(_checkSurrondedByWater);
            grid3.Widgets.Add(_checkSmooth);
            grid3.Widgets.Add(_checkRemoveSmalIslands);
            grid3.Widgets.Add(_checkRemoveSmallLakes);
            grid3.Widgets.Add(_buttonGenerate);
            grid3.Widgets.Add(grid2);
            grid3.Widgets.Add(_buttonSaveAsPng);

            _imageGenerated    = new Image();
            _imageGenerated.Id = "_imageGenerated";
            _imageGenerated.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _imageGenerated.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;

            _textGenerating      = new TextBlock();
            _textGenerating.Text = "Generating...";
            _textGenerating.Id   = "_textGenerating";
            _textGenerating.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _textGenerating.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;

            var panel1 = new Panel();

            panel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            panel1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            panel1.GridPositionX       = 2;
            panel1.Widgets.Add(_imageGenerated);
            panel1.Widgets.Add(_textGenerating);


            Id = "_splitPane";
            HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            Widgets.Add(grid3);
            Widgets.Add(panel1);
        }
Esempio n. 21
0
        private void BuildUI()
        {
            menuItemNew              = new MenuItem();
            menuItemNew.Text         = "&New";
            menuItemNew.ShortcutText = "Ctrl+N";
            menuItemNew.Id           = "menuItemNew";

            menuItemOpen              = new MenuItem();
            menuItemOpen.Text         = "&Open...";
            menuItemOpen.ShortcutText = "Ctrl+O";
            menuItemOpen.Id           = "menuItemOpen";

            menuItemSave              = new MenuItem();
            menuItemSave.Text         = "&Save";
            menuItemSave.ShortcutText = "Ctrl+S";
            menuItemSave.Id           = "menuItemSave";

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

            var menuSeparator1 = new MenuSeparator();

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

            var menuSeparator2 = new MenuSeparator();

            menuItemQuit              = new MenuItem();
            menuItemQuit.Text         = "&Quit";
            menuItemQuit.ShortcutText = "Ctrl+Q";
            menuItemQuit.Id           = "menuItemQuit";

            menuItemFile      = new MenuItem();
            menuItemFile.Text = "&File";
            menuItemFile.Id   = "menuItemFile";
            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.Text = "About";
            menuItemAbout.Id   = "menuItemAbout";

            menuItemHelp      = new MenuItem();
            menuItemHelp.Text = "&Help";
            menuItemHelp.Id   = "menuItemHelp";
            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();

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

            var scrollViewer1 = new ScrollViewer();

            scrollViewer1.Content = textArea;


            Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            Widgets.Add(_mainMenu);
            Widgets.Add(horizontalSeparator1);
            Widgets.Add(scrollViewer1);
        }
Esempio n. 22
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.TextColor         = Color.White;
            textArea.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            textArea.MessageTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            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 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(mainMenu);
            Widgets.Add(scrollPane1);
        }
Esempio n. 23
0
        private void BuildUI()
        {
            _saveEntity      = new MenuItem();
            _saveEntity.Text = "Save Entity";
            _saveEntity.Id   = "_saveEntity";

            _newEntity      = new MenuItem();
            _newEntity.Text = "New Entity";
            _newEntity.Id   = "_newEntity";

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

            var verticalMenu1 = new VerticalMenu();

            verticalMenu1.Background = new SolidBrush("#404040FF");
            verticalMenu1.Items.Add(_saveEntity);
            verticalMenu1.Items.Add(_newEntity);
            verticalMenu1.Items.Add(_quit);

            var mainGrid = new Grid();

            //mainGrid.ShowGridLines = true;
            //mainGrid.ColumnSpacing = 8;
            //mainGrid.RowSpacing = 8;
            mainGrid.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            mainGrid.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            mainGrid.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Part,
            });
            mainGrid.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });

            mainGrid.Widgets.Add(verticalMenu1);


            target                 = Entity.FromDefinition(Critter.GetCritter(TextureAtlas.Circle, Color.White));
            target.Tag             = "Foo";
            _simulation.EditTarget = target;

            _componentEditor                    = new PropertyGrid();
            _editorScrollPane                   = new ScrollViewer();
            _editorScrollPane.MinHeight         = 250;
            _editorScrollPane.Background        = new SolidBrush("#202020FF");
            _editorScrollPane.VerticalAlignment = VerticalAlignment.Bottom;

            _editorScrollPane.Content    = _componentEditor;
            _editorScrollPane.GridRow    = 1;
            _editorScrollPane.GridColumn = 1;
            mainGrid.Widgets.Add(_editorScrollPane);

            _entityTreeScroller            = new ScrollViewer();
            _entityTreeScroller.MinHeight  = 250;
            _entityTreeScroller.MinWidth   = 250;
            _entityTreeScroller.Background = new SolidBrush("#202020FF");
            _entityTreeScroller.Content    = new Tree();
            _entityTreeScroller.GridRow    = 1;
            mainGrid.Widgets.Add(_entityTreeScroller);
            RebuildTree();


            _entityEditWidget = new EntityEditWidget(target, this);
            //BuildTree(target, (CustomTree)root, "", entityTree);

            Panel previewPanel = new Panel();

            previewPanel.GridColumn = 1;
            previewPanel.MinWidth   = 4000;
            previewPanel.MinHeight  = 4000;
            Widgets.Add(previewPanel);
            Widgets.Add(mainGrid);
        }
Esempio n. 24
0
        private void BuildUI()
        {
            var textBlock1 = new TextBlock();

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

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

            var textBlock2 = new TextBlock();

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

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

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

            var textBlock3 = new TextBlock();

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

            _textNamespace                   = new TextField();
            _textNamespace.Text              = "";
            _textNamespace.TextColor         = Color.White;
            _textNamespace.DisabledTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            _textNamespace.MessageTextColor = new Color
            {
                B           = 170,
                G           = 170,
                R           = 170,
                A           = 255,
                PackedValue = 4289374890,
            };
            _textNamespace.Id = "_textNamespace";
            _textNamespace.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _textNamespace.GridPositionX       = 1;
            _textNamespace.CanFocus            = true;


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

            var label1 = new Label();

            label1.Text = "Font:";

            _textBoxFont          = new TextBox();
            _textBoxFont.Text     = "(default)";
            _textBoxFont.Readonly = true;
            _textBoxFont.Id       = "_textBoxFont";

            _buttonBrowseFont      = new TextButton();
            _buttonBrowseFont.Text = "Browse...";
            _buttonBrowseFont.Id   = "_buttonBrowseFont";

            _buttonReset      = new TextButton();
            _buttonReset.Text = "Reset";
            _buttonReset.Id   = "_buttonReset";

            var horizontalStackPanel1 = new HorizontalStackPanel();

            horizontalStackPanel1.Spacing = 8;
            horizontalStackPanel1.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            horizontalStackPanel1.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            horizontalStackPanel1.Widgets.Add(label1);
            horizontalStackPanel1.Widgets.Add(_textBoxFont);
            horizontalStackPanel1.Widgets.Add(_buttonBrowseFont);
            horizontalStackPanel1.Widgets.Add(_buttonReset);

            var label2 = new Label();

            label2.Text = "Font Size:";

            _spinButtonFontSize       = new SpinButton();
            _spinButtonFontSize.Value = 32;
            _spinButtonFontSize.Width = 40;
            _spinButtonFontSize.Id    = "_spinButtonFontSize";

            var label3 = new Label();

            label3.Text = "Scale:";

            var label4 = new Label();

            label4.Text = "0.1";

            _sliderScale         = new HorizontalSlider();
            _sliderScale.Minimum = 0.1f;
            _sliderScale.Maximum = 10;
            _sliderScale.Value   = 1;
            _sliderScale.Width   = 200;
            _sliderScale.Id      = "_sliderScale";

            _labelScaleValue      = new Label();
            _labelScaleValue.Text = "5.4";
            _labelScaleValue.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _labelScaleValue.Id = "_labelScaleValue";

            var verticalStackPanel1 = new VerticalStackPanel();

            verticalStackPanel1.Widgets.Add(_sliderScale);
            verticalStackPanel1.Widgets.Add(_labelScaleValue);

            var label5 = new Label();

            label5.Text = "10";

            _checkBoxSmoothText      = new CheckBox();
            _checkBoxSmoothText.Text = "Smooth Text";
            _checkBoxSmoothText.Id   = "_checkBoxSmoothText";

            var horizontalStackPanel2 = new HorizontalStackPanel();

            horizontalStackPanel2.Spacing = 8;
            horizontalStackPanel2.Widgets.Add(label2);
            horizontalStackPanel2.Widgets.Add(_spinButtonFontSize);
            horizontalStackPanel2.Widgets.Add(label3);
            horizontalStackPanel2.Widgets.Add(label4);
            horizontalStackPanel2.Widgets.Add(verticalStackPanel1);
            horizontalStackPanel2.Widgets.Add(label5);
            horizontalStackPanel2.Widgets.Add(_checkBoxSmoothText);

            var label6 = new Label();

            label6.Text = "Resolution Factor:";

            _spinButtonResolutionFactor         = new SpinButton();
            _spinButtonResolutionFactor.Minimum = 1;
            _spinButtonResolutionFactor.Value   = 1;
            _spinButtonResolutionFactor.Width   = 40;
            _spinButtonResolutionFactor.Id      = "_spinButtonResolutionFactor";

            var label7 = new Label();

            label7.Text = "Kernel Width:";

            _spinButtonKernelWidth         = new SpinButton();
            _spinButtonKernelWidth.Minimum = 0;
            _spinButtonKernelWidth.Width   = 40;
            _spinButtonKernelWidth.Id      = "_spinButtonKernelWidth";

            var label8 = new Label();

            label8.Text = "Kernel Height:";

            _spinButtonKernelHeight         = new SpinButton();
            _spinButtonKernelHeight.Minimum = 0;
            _spinButtonKernelHeight.Width   = 40;
            _spinButtonKernelHeight.Id      = "_spinButtonKernelHeight";

            var horizontalStackPanel3 = new HorizontalStackPanel();

            horizontalStackPanel3.Spacing = 8;
            horizontalStackPanel3.Widgets.Add(label6);
            horizontalStackPanel3.Widgets.Add(_spinButtonResolutionFactor);
            horizontalStackPanel3.Widgets.Add(label7);
            horizontalStackPanel3.Widgets.Add(_spinButtonKernelWidth);
            horizontalStackPanel3.Widgets.Add(label8);
            horizontalStackPanel3.Widgets.Add(_spinButtonKernelHeight);

            var verticalStackPanel2 = new VerticalStackPanel();

            verticalStackPanel2.Spacing = 8;
            verticalStackPanel2.Padding = new Thickness(0, 8);
            verticalStackPanel2.Widgets.Add(horizontalStackPanel1);
            verticalStackPanel2.Widgets.Add(horizontalStackPanel2);
            verticalStackPanel2.Widgets.Add(horizontalStackPanel3);

            var horizontalSeparator2 = new HorizontalSeparator();

            _textBoxText                   = new TextBox();
            _textBoxText.Text              = "The quick brown\\nfox jumps over\\nthe lazy dog";
            _textBoxText.Multiline         = true;
            _textBoxText.Wrap              = true;
            _textBoxText.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _textBoxText.Id                = "_textBoxText";

            var scrollViewer1 = new ScrollViewer();

            scrollViewer1.Content = _textBoxText;

            var verticalStackPanel3 = new VerticalStackPanel();

            verticalStackPanel3.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            verticalStackPanel3.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            verticalStackPanel3.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            verticalStackPanel3.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            verticalStackPanel3.Widgets.Add(horizontalSeparator1);
            verticalStackPanel3.Widgets.Add(verticalStackPanel2);
            verticalStackPanel3.Widgets.Add(horizontalSeparator2);
            verticalStackPanel3.Widgets.Add(scrollViewer1);


            Widgets.Add(verticalStackPanel3);
        }
Esempio n. 26
0
        private void BuildUI()
        {
            var image1 = new Image();

            image1.Renderable = MyraEnvironment.DefaultAssetManager.Load <TextureRegion>("images/background.jpg");

            var label1 = new Label();

            label1.Text                = "RIVIERE";
            label1.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans48.fnt");
            label1.TextAlign           = Myra.Graphics2D.UI.TextAlign.Center;
            label1.Top                 = 30;
            label1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;

            var label2 = new Label();

            label2.Text = "Ajouter un joueur";
            label2.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans32.fnt");
            label2.Left = 30;
            label2.Top  = 100;

            playername_textbox         = new TextBox();
            playername_textbox.Font    = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans32.fnt");
            playername_textbox.Left    = 30;
            playername_textbox.Top     = 150;
            playername_textbox.Width   = 250;
            playername_textbox.Padding = new Thickness(3);
            playername_textbox.Id      = "playername_textbox";

            add_player_button         = new TextButton();
            add_player_button.Text    = "OK";
            add_player_button.Font    = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans32.fnt");
            add_player_button.Enabled = false;
            add_player_button.Left    = 280;
            add_player_button.Top     = 150;
            add_player_button.Padding = new Thickness(3);
            add_player_button.Id      = "add_player_button";

            removeplayer_button                   = new ImageButton();
            removeplayer_button.Image             = MyraEnvironment.DefaultAssetManager.Load <TextureRegion>("images/remove-icon.png");
            removeplayer_button.OverImage         = MyraEnvironment.DefaultAssetManager.Load <TextureRegion>("images/remove-icon-dark.png");
            removeplayer_button.Visible           = false;
            removeplayer_button.BorderThickness   = new Thickness(0, 7, 0, 0);
            removeplayer_button.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
            removeplayer_button.Id                = "removeplayer_button";

            playername_label                   = new Label();
            playername_label.Text              = "Georges";
            playername_label.Font              = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans32.fnt");
            playername_label.Padding           = new Thickness(3);
            playername_label.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
            playername_label.GridColumn        = 1;
            playername_label.Visible           = false;
            playername_label.Id                = "playername_label";

            playerslist_grid = new Grid();
            playerslist_grid.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            playerslist_grid.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            playerslist_grid.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            playerslist_grid.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left;
            playerslist_grid.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Top;
            playerslist_grid.Left = 30;
            playerslist_grid.Top  = 200;
            playerslist_grid.Id   = "playerslist_grid";
            playerslist_grid.Widgets.Add(removeplayer_button);
            playerslist_grid.Widgets.Add(playername_label);

            startgame_button           = new TextButton("transparent-bg");
            startgame_button.Text      = "Demarrez le jeu";
            startgame_button.TextColor = new Color
            {
                B = 255,
                G = 254,
                R = 255,
                A = 255,
            };
            startgame_button.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans48.fnt");
            startgame_button.Visible             = false;
            startgame_button.Left                = 100;
            startgame_button.Top                 = 150;
            startgame_button.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            startgame_button.Id = "startgame_button";

            messagestartgame_label                     = new Label();
            messagestartgame_label.Text                = "Il faut encore X joueurs";
            messagestartgame_label.Font                = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans32.fnt");
            messagestartgame_label.Left                = 100;
            messagestartgame_label.Top                 = 150;
            messagestartgame_label.Padding             = new Thickness(15, 5, 0, 0);
            messagestartgame_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            messagestartgame_label.Id                  = "messagestartgame_label";

            var image2 = new Image();

            image2.Renderable = MyraEnvironment.DefaultAssetManager.Load <TextureRegion>("images/background_rules.png");
            image2.MaxWidth   = 400;
            image2.MaxHeight  = 350;

            var label3 = new Label();

            label3.Text                = "Regles Speciales";
            label3.TextColor           = Color.Black;
            label3.Top                 = 65;
            label3.BorderThickness     = new Thickness(0, 0, 0, 3);
            label3.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            label3.Border              = new SolidBrush("#000000FF");

            ruleshuffleplayer_checkbox                  = new CheckBox();
            ruleshuffleplayer_checkbox.Text             = "Ordre des joueurs aleatoire";
            ruleshuffleplayer_checkbox.TextColor        = Color.Black;
            ruleshuffleplayer_checkbox.Font             = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans24.fnt");
            ruleshuffleplayer_checkbox.ImageTextSpacing = 15;
            ruleshuffleplayer_checkbox.Left             = 50;
            ruleshuffleplayer_checkbox.Top              = 80;
            ruleshuffleplayer_checkbox.Id               = "ruleshuffleplayer_checkbox";

            ruleguillaumeheart_checkbox                  = new CheckBox();
            ruleguillaumeheart_checkbox.Text             = "Le Coeur de Guilllaume";
            ruleguillaumeheart_checkbox.TextColor        = Color.Black;
            ruleguillaumeheart_checkbox.Font             = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans24.fnt");
            ruleguillaumeheart_checkbox.ImageTextSpacing = 15;
            ruleguillaumeheart_checkbox.Left             = 50;
            ruleguillaumeheart_checkbox.Top              = 80;
            ruleguillaumeheart_checkbox.GridRow          = 1;
            ruleguillaumeheart_checkbox.Id               = "ruleguillaumeheart_checkbox";

            ruleaceworst_checkbox                  = new CheckBox();
            ruleaceworst_checkbox.Text             = "Le 1 (as), c\'est moins bien";
            ruleaceworst_checkbox.TextColor        = Color.Black;
            ruleaceworst_checkbox.Font             = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans24.fnt");
            ruleaceworst_checkbox.ImageTextSpacing = 15;
            ruleaceworst_checkbox.Left             = 50;
            ruleaceworst_checkbox.Top              = 80;
            ruleaceworst_checkbox.GridRow          = 2;
            ruleaceworst_checkbox.Id               = "ruleaceworst_checkbox";

            rulejuliencheh_checkbox                  = new CheckBox();
            rulejuliencheh_checkbox.Text             = "On est bien cheh Julien (a venir)";
            rulejuliencheh_checkbox.TextColor        = Color.Black;
            rulejuliencheh_checkbox.Font             = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans24.fnt");
            rulejuliencheh_checkbox.ImageTextSpacing = 15;
            rulejuliencheh_checkbox.Left             = 50;
            rulejuliencheh_checkbox.Top              = 80;
            rulejuliencheh_checkbox.GridRow          = 3;
            rulejuliencheh_checkbox.IsDraggable      = true;
            rulejuliencheh_checkbox.Id               = "rulejuliencheh_checkbox";

            ruleericsubtitles_checkbox                  = new CheckBox();
            ruleericsubtitles_checkbox.Text             = "Sous-titrages teletextes (a venir)";
            ruleericsubtitles_checkbox.TextColor        = Color.Black;
            ruleericsubtitles_checkbox.Font             = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/comicSans24.fnt");
            ruleericsubtitles_checkbox.ImageTextSpacing = 15;
            ruleericsubtitles_checkbox.Enabled          = false;
            ruleericsubtitles_checkbox.Left             = 50;
            ruleericsubtitles_checkbox.Top              = 80;
            ruleericsubtitles_checkbox.GridRow          = 4;
            ruleericsubtitles_checkbox.IsDraggable      = true;
            ruleericsubtitles_checkbox.Id               = "ruleericsubtitles_checkbox";

            var grid1 = new Grid();

            grid1.RowSpacing = 5;
            grid1.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            grid1.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            grid1.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            grid1.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            grid1.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            grid1.Top = 40;
            grid1.Widgets.Add(ruleshuffleplayer_checkbox);
            grid1.Widgets.Add(ruleguillaumeheart_checkbox);
            grid1.Widgets.Add(ruleaceworst_checkbox);
            grid1.Widgets.Add(rulejuliencheh_checkbox);
            grid1.Widgets.Add(ruleericsubtitles_checkbox);

            var panel1 = new Panel();

            panel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            panel1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            panel1.Left = 150;
            panel1.Top  = 100;
            panel1.Widgets.Add(image2);
            panel1.Widgets.Add(label3);
            panel1.Widgets.Add(grid1);


            Widgets.Add(image1);
            Widgets.Add(label1);
            Widgets.Add(label2);
            Widgets.Add(playername_textbox);
            Widgets.Add(add_player_button);
            Widgets.Add(playerslist_grid);
            Widgets.Add(startgame_button);
            Widgets.Add(messagestartgame_label);
            Widgets.Add(panel1);
        }
Esempio n. 27
0
        private void BuildUI()
        {
            _buttonAllWidgets           = new TextButton();
            _buttonAllWidgets.Text      = "AllWidgets";
            _buttonAllWidgets.TextColor = Color.White;
            _buttonAllWidgets.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonAllWidgets.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonAllWidgets.IgnoreMouseButton          = true;
            _buttonAllWidgets.Id        = "_buttonAllWidgets";
            _buttonAllWidgets.WidthHint = 100;

            _buttonGrid           = new TextButton();
            _buttonGrid.Text      = "Grid";
            _buttonGrid.TextColor = Color.White;
            _buttonGrid.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonGrid.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonGrid.IgnoreMouseButton          = true;
            _buttonGrid.Id            = "_buttonGrid";
            _buttonGrid.WidthHint     = 100;
            _buttonGrid.GridPositionX = 1;

            _buttonNotepad           = new TextButton();
            _buttonNotepad.Text      = "Notepad";
            _buttonNotepad.TextColor = Color.White;
            _buttonNotepad.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
            _buttonNotepad.ContentVerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Center;
            _buttonNotepad.IgnoreMouseButton          = true;
            _buttonNotepad.Id            = "_buttonNotepad";
            _buttonNotepad.WidthHint     = 100;
            _buttonNotepad.GridPositionX = 2;

            var grid1 = new Grid();

            grid1.DrawLinesColor = Color.White;
            grid1.ColumnSpacing  = 4;
            grid1.ColumnsProportions.Add(new Proportion());
            grid1.ColumnsProportions.Add(new Proportion());
            grid1.ColumnsProportions.Add(new Proportion());
            grid1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            grid1.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            grid1.Widgets.Add(_buttonAllWidgets);
            grid1.Widgets.Add(_buttonGrid);
            grid1.Widgets.Add(_buttonNotepad);

            _panelContent    = new Panel();
            _panelContent.Id = "_panelContent";
            _panelContent.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch;
            _panelContent.VerticalAlignment   = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _panelContent.GridPositionY       = 1;


            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(grid1);
            Widgets.Add(_panelContent);
        }
Esempio n. 28
0
        private void BuildUI()
        {
            _menuItemOpenFile              = new MenuItem();
            _menuItemOpenFile.Text         = "&Open";
            _menuItemOpenFile.ShortcutText = "Ctrl+O";
            _menuItemOpenFile.Id           = "_menuItemOpenFile";

            _menuItemSaveFile              = new MenuItem();
            _menuItemSaveFile.Text         = "&Save";
            _menuItemSaveFile.ShortcutText = "Ctrl+S";
            _menuItemSaveFile.Id           = "_menuItemSaveFile";

            _menuItemChooseFolder              = new MenuItem();
            _menuItemChooseFolder.Text         = "Choose Fol&der";
            _menuItemChooseFolder.ShortcutText = "Ctrl+D";
            _menuItemChooseFolder.Id           = "_menuItemChooseFolder";

            _menuItemChooseColor              = new MenuItem();
            _menuItemChooseColor.Text         = "Choose Co&lor";
            _menuItemChooseColor.ShortcutText = "Ctrl+L";
            _menuItemChooseColor.Id           = "_menuItemChooseColor";

            var menuSeparator1 = new MenuSeparator();

            _menuItemQuit              = new MenuItem();
            _menuItemQuit.Text         = "&Quit";
            _menuItemQuit.ShortcutText = "Ctrl+Q";
            _menuItemQuit.Id           = "_menuItemQuit";

            _menuFile      = new MenuItem();
            _menuFile.Text = "&File";
            _menuFile.Id   = "_menuFile";
            _menuFile.Items.Add(_menuItemOpenFile);
            _menuFile.Items.Add(_menuItemSaveFile);
            _menuFile.Items.Add(_menuItemChooseFolder);
            _menuFile.Items.Add(_menuItemChooseColor);
            _menuFile.Items.Add(menuSeparator1);
            _menuFile.Items.Add(_menuItemQuit);

            _menuItemCopy              = new MenuItem();
            _menuItemCopy.Text         = "&Copy";
            _menuItemCopy.ShortcutText = "Ctrl+Insert, Ctrl+C";
            _menuItemCopy.Id           = "_menuItemCopy";

            _menuItemPaste              = new MenuItem();
            _menuItemPaste.Text         = "&Paste";
            _menuItemPaste.ShortcutText = "Shift+Insert, Ctrl+V";
            _menuItemPaste.Id           = "_menuItemPaste";

            var menuSeparator2 = new MenuSeparator();

            _menuItemUndo              = new MenuItem();
            _menuItemUndo.Text         = "&Undo";
            _menuItemUndo.ShortcutText = "Ctrl+Z";
            _menuItemUndo.Id           = "_menuItemUndo";

            _menuItemRedo              = new MenuItem();
            _menuItemRedo.Text         = "&Redo";
            _menuItemRedo.ShortcutText = "Ctrl+Y";
            _menuItemRedo.Id           = "_menuItemRedo";

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

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

            _menuHelp      = new MenuItem();
            _menuHelp.Text = "&Help";
            _menuHelp.Id   = "_menuHelp";
            _menuHelp.Items.Add(_menuItemAbout);

            _mainMenu = new HorizontalMenu();
            _mainMenu.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch;
            _mainMenu.Id = "_mainMenu";
            _mainMenu.Items.Add(_menuFile);
            _mainMenu.Items.Add(_menuEdit);
            _mainMenu.Items.Add(_menuHelp);

            var label1 = new Label();

            label1.Text = "Button:";

            _buttonSaveFile            = new ImageTextButton();
            _buttonSaveFile.Text       = "Save File";
            _buttonSaveFile.Padding    = new Thickness(8, 0);
            _buttonSaveFile.GridColumn = 1;
            _buttonSaveFile.Id         = "_buttonSaveFile";

            _textSaveFile            = new TextBox();
            _textSaveFile.GridColumn = 2;
            _textSaveFile.Id         = "_textSaveFile";

            var label2 = new Label();

            label2.Text    = "Another Button:";
            label2.GridRow = 1;

            _buttonOpenFile            = new ImageTextButton();
            _buttonOpenFile.Text       = "Open File";
            _buttonOpenFile.Padding    = new Thickness(8, 0);
            _buttonOpenFile.GridColumn = 1;
            _buttonOpenFile.GridRow    = 1;
            _buttonOpenFile.Id         = "_buttonOpenFile";

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

            var label3 = new Label();

            label3.Text    = "Blue Button:";
            label3.GridRow = 2;

            _buttonChooseFolder            = new ImageTextButton("blue");
            _buttonChooseFolder.Text       = "Choose Folder";
            _buttonChooseFolder.Padding    = new Thickness(8, 0);
            _buttonChooseFolder.GridColumn = 1;
            _buttonChooseFolder.GridRow    = 2;
            _buttonChooseFolder.Id         = "_buttonChooseFolder";

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

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

            _buttonChooseColor            = new TextButton();
            _buttonChooseColor.Text       = "Choose Color";
            _buttonChooseColor.Padding    = new Thickness(8, 0);
            _buttonChooseColor.GridColumn = 1;
            _buttonChooseColor.GridRow    = 3;
            _buttonChooseColor.Id         = "_buttonChooseColor";

            var label4 = new Label();

            label4.Text    = "Image Button:";
            label4.GridRow = 4;

            _imageButton            = new ImageButton();
            _imageButton.Padding    = new Thickness(8, 0);
            _imageButton.GridColumn = 1;
            _imageButton.GridRow    = 4;
            _imageButton.Id         = "_imageButton";

            var checkBox1 = new CheckBox();

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

            var label5 = new Label();

            label5.Text    = "Horizontal Slider:";
            label5.GridRow = 6;

            var horizontalSlider1 = new HorizontalSlider();

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

            var label6 = new Label();

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

            var listItem1 = new ListItem();

            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,
                R = 0,
                A = 255,
            };

            var comboBox1 = new ComboBox();

            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 label7 = new Label();

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

            var textBox1 = new TextBox();

            textBox1.GridColumn     = 1;
            textBox1.GridRow        = 8;
            textBox1.GridColumnSpan = 2;

            var label8 = new Label();

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

            var spinButton1 = new SpinButton();

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

            var label9 = new Label();

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

            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.Width          = 200;
            listBox1.GridColumn     = 1;
            listBox1.GridRow        = 10;
            listBox1.GridColumnSpan = 2;
            listBox1.Items.Add(listItem4);
            listBox1.Items.Add(listItem5);
            listBox1.Items.Add(listItem6);

            var label10 = new Label();

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

            var menuItem1 = new MenuItem();

            menuItem1.Text = "Start New Game";

            var menuItem2 = new MenuItem();

            menuItem2.Text = "Options";

            var menuItem3 = new MenuItem();

            menuItem3.Text = "Quit";

            var verticalMenu1 = new VerticalMenu();

            verticalMenu1.GridColumn = 1;
            verticalMenu1.GridRow    = 11;
            verticalMenu1.Items.Add(menuItem1);
            verticalMenu1.Items.Add(menuItem2);
            verticalMenu1.Items.Add(menuItem3);

            var label11 = new Label();

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

            _gridRight = new Grid();
            _gridRight.ColumnSpacing        = 8;
            _gridRight.RowSpacing           = 8;
            _gridRight.DefaultRowProportion = new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            };
            _gridRight.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            _gridRight.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            _gridRight.ColumnsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            _gridRight.Id = "_gridRight";
            _gridRight.Widgets.Add(label1);
            _gridRight.Widgets.Add(_buttonSaveFile);
            _gridRight.Widgets.Add(_textSaveFile);
            _gridRight.Widgets.Add(label2);
            _gridRight.Widgets.Add(_buttonOpenFile);
            _gridRight.Widgets.Add(_textOpenFile);
            _gridRight.Widgets.Add(label3);
            _gridRight.Widgets.Add(_buttonChooseFolder);
            _gridRight.Widgets.Add(_textChooseFolder);
            _gridRight.Widgets.Add(_textButtonLabel);
            _gridRight.Widgets.Add(_buttonChooseColor);
            _gridRight.Widgets.Add(label4);
            _gridRight.Widgets.Add(_imageButton);
            _gridRight.Widgets.Add(checkBox1);
            _gridRight.Widgets.Add(label5);
            _gridRight.Widgets.Add(horizontalSlider1);
            _gridRight.Widgets.Add(label6);
            _gridRight.Widgets.Add(comboBox1);
            _gridRight.Widgets.Add(label7);
            _gridRight.Widgets.Add(textBox1);
            _gridRight.Widgets.Add(label8);
            _gridRight.Widgets.Add(spinButton1);
            _gridRight.Widgets.Add(label9);
            _gridRight.Widgets.Add(listBox1);
            _gridRight.Widgets.Add(label10);
            _gridRight.Widgets.Add(verticalMenu1);
            _gridRight.Widgets.Add(label11);

            var scrollViewer1 = new ScrollViewer();

            scrollViewer1.Content = _gridRight;

            var label12 = new Label();

            label12.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 Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            grid1.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            grid1.RowsProportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            grid1.Widgets.Add(label12);
            grid1.Widgets.Add(verticalSlider1);

            var label13 = new Label();

            label13.Text = "Progress Bars:";

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

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

            var grid2 = new Grid();

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

            var verticalSplitPane1 = new VerticalSplitPane();

            verticalSplitPane1.Widgets.Add(grid1);
            verticalSplitPane1.Widgets.Add(grid2);

            var horizontalSplitPane1 = new HorizontalSplitPane();

            horizontalSplitPane1.Widgets.Add(scrollViewer1);
            horizontalSplitPane1.Widgets.Add(verticalSplitPane1);


            Spacing = 8;
            Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            Widgets.Add(_mainMenu);
            Widgets.Add(horizontalSplitPane1);
        }
Esempio n. 29
0
        private void BuildUI()
        {
            _menuFileNew              = new MenuItem();
            _menuFileNew.Text         = "&New";
            _menuFileNew.ShortcutText = "Ctrl+N";
            _menuFileNew.Id           = "_menuFileNew";

            _menuFileOpen              = new MenuItem();
            _menuFileOpen.Text         = "&Open";
            _menuFileOpen.ShortcutText = "Ctrl+O";
            _menuFileOpen.Id           = "_menuFileOpen";

            _menuFileReload              = new MenuItem();
            _menuFileReload.Text         = "&Reload";
            _menuFileReload.ShortcutText = "Ctrl+R";
            _menuFileReload.Id           = "_menuFileReload";

            _menuFileSave              = new MenuItem();
            _menuFileSave.Text         = "&Save";
            _menuFileSave.ShortcutText = "Ctrl+S";
            _menuFileSave.Id           = "_menuFileSave";

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

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

            var menuSeparator1 = new MenuSeparator();

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

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

            var menuSeparator2 = new MenuSeparator();

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

            var menuSeparator3 = new MenuSeparator();

            _menuFileQuit              = new MenuItem();
            _menuFileQuit.Text         = "&Quit";
            _menuFileQuit.ShortcutText = "Ctrl+Q";
            _menuFileQuit.Id           = "_menuFileQuit";

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

            _menuItemSelectAll              = new MenuItem();
            _menuItemSelectAll.Text         = "Select &All";
            _menuItemSelectAll.ShortcutText = "Ctrl+A";
            _menuItemSelectAll.Id           = "_menuItemSelectAll";

            _menuItemCopy              = new MenuItem();
            _menuItemCopy.Text         = "&Copy";
            _menuItemCopy.ShortcutText = "Ctrl+Insert, Ctrl+C";
            _menuItemCopy.Id           = "_menuItemCopy";

            _menuItemPaste              = new MenuItem();
            _menuItemPaste.Text         = "&Paste";
            _menuItemPaste.ShortcutText = "Shift+Insert, Ctrl+V";
            _menuItemPaste.Id           = "_menuItemPaste";

            var menuSeparator4 = new MenuSeparator();

            _menuEditFormatSource              = new MenuItem();
            _menuEditFormatSource.Text         = "&Format Source";
            _menuEditFormatSource.ShortcutText = "Ctrl+F";
            _menuEditFormatSource.Id           = "_menuEditFormatSource";

            var menuItem1 = new MenuItem();

            menuItem1.Text = "&Edit";
            menuItem1.Items.Add(_menuItemSelectAll);
            menuItem1.Items.Add(_menuItemCopy);
            menuItem1.Items.Add(_menuItemPaste);
            menuItem1.Items.Add(menuSeparator4);
            menuItem1.Items.Add(_menuEditFormatSource);

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

            var menuItem2 = new MenuItem();

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

            _mainMenu    = new HorizontalMenu();
            _mainMenu.Id = "_mainMenu";
            _mainMenu.Items.Add(_menuFile);
            _mainMenu.Items.Add(menuItem1);
            _mainMenu.Items.Add(menuItem2);

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

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

            var scrollViewer1 = new ScrollViewer();

            scrollViewer1.Content = _textSource;

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

            var horizontalSeparator1 = new HorizontalSeparator();

            _textStatus      = new Label();
            _textStatus.Text = "Reloading...";
            _textStatus.Id   = "_textStatus";

            var verticalStackPanel1 = new VerticalStackPanel();

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

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

            var horizontalSeparator2 = new HorizontalSeparator();

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

            var verticalStackPanel2 = new VerticalStackPanel();

            verticalStackPanel2.Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            verticalStackPanel2.Widgets.Add(_propertyGridPane);
            verticalStackPanel2.Widgets.Add(horizontalSeparator2);
            verticalStackPanel2.Widgets.Add(_textLocation);

            _topSplitPane    = new HorizontalSplitPane();
            _topSplitPane.Id = "_topSplitPane";
            _topSplitPane.Widgets.Add(verticalStackPanel1);
            _topSplitPane.Widgets.Add(verticalStackPanel2);


            Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Auto,
            });
            Proportions.Add(new Proportion
            {
                Type = Myra.Graphics2D.UI.ProportionType.Fill,
            });
            Widgets.Add(_mainMenu);
            Widgets.Add(_topSplitPane);
        }
Esempio n. 30
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);
        }