private void BuildUI() { Score = new Label(); Score.Text = "99%"; Score.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; Score.GridRow = 1; Score.Id = "Score"; Back = new TextButton(); Back.Text = "Back"; Back.Padding = new Thickness(5); Back.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; Back.GridRow = 2; Back.Id = "Back"; RowSpacing = 40; RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); Widgets.Add(Score); Widgets.Add(Back); }
protected ProgressBar(ProgressBarStyle style) : base(style) { _filledImage = new Image { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch }; if (Orientation == Orientation.Horizontal) { ColumnsProportions.Add(new Proportion(ProportionType.Part, 0)); ColumnsProportions.Add(new Proportion(ProportionType.Fill)); TotalColumnsPart = 1.0f; } else { RowsProportions.Add(new Proportion(ProportionType.Fill)); RowsProportions.Add(new Proportion(ProportionType.Part, 0)); TotalRowsPart = 1.0f; _filledImage.GridPositionY = 1; } Widgets.Add(_filledImage); if (style != null) { ApplyProgressBarStyle(style); } Maximum = 100; }
public TreeNode(TreeStyle style, Tree topTree) { _topTree = topTree; ColumnSpacing = 2; RowSpacing = 2; if (_topTree != null) { _topTree.AllNodes.Add(this); } _mark = new ImageButton((ImageButtonStyle)null) { Toggleable = true, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center }; _mark.Down += MarkOnDown; _mark.Up += MarkOnUp; Widgets.Add(_mark); _label = new TextBlock { GridPositionX = 1, Wrap = false }; Widgets.Add(_label); HorizontalAlignment = HorizontalAlignment.Stretch; VerticalAlignment = VerticalAlignment.Stretch; ColumnsProportions.Add(new Proportion(ProportionType.Auto)); ColumnsProportions.Add(new Proportion(ProportionType.Fill)); RowsProportions.Add(new Proportion(ProportionType.Auto)); RowsProportions.Add(new Proportion(ProportionType.Auto)); // Second is yet another grid holding child nodes _childNodesGrid = new Grid { Visible = false, GridPositionX = 1, GridPositionY = 1 }; Widgets.Add(_childNodesGrid); if (style != null) { ApplyTreeNodeStyle(style); } UpdateMark(); UpdateHasRoot(); }
public SubGrid(PropertyGrid parent, object value, string header, string category, Record parentProperty) { ColumnSpacing = 4; RowSpacing = 4; ColumnsProportions.Add(new Proportion(ProportionType.Auto)); ColumnsProportions.Add(new Proportion(ProportionType.Fill)); RowsProportions.Add(new Proportion(ProportionType.Auto)); RowsProportions.Add(new Proportion(ProportionType.Auto)); _propertyGrid = new PropertyGrid(parent.PropertyGridStyle, category, parentProperty) { Object = value, Visible = false, HorizontalAlignment = HorizontalAlignment.Stretch, GridPositionX = 1, GridPositionY = 1, ColorChangeHandler = parent.ColorChangeHandler, _parentGrid = parent }; // Mark _mark = new ImageButton(parent.PropertyGridStyle.MarkStyle) { Toggleable = true, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center }; Widgets.Add(_mark); _mark.Down += (sender, args) => { _propertyGrid.Visible = true; parent._expandedCategories.Add(category); }; _mark.Up += (sender, args) => { _propertyGrid.Visible = false; parent._expandedCategories.Remove(category); }; var label = new TextBlock(parent.PropertyGridStyle.LabelStyle) { Text = header, GridPositionX = 1 }; Widgets.Add(label); Widgets.Add(_propertyGrid); }
public SpinButton(SpinButtonStyle style) : base(style) { HorizontalAlignment = HorizontalAlignment.Left; VerticalAlignment = VerticalAlignment.Top; ColumnsProportions.Add(new Proportion(ProportionType.Fill)); ColumnsProportions.Add(new Proportion()); RowsProportions.Add(new Proportion()); RowsProportions.Add(new Proportion()); _textField = new TextField { GridSpanY = 2, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, InputFilter = InputFilter }; _textField.TextChanged += TextFieldOnTextChanged; _textField.TextChangedByUser += TextFieldOnTextChangedByUser; Widgets.Add(_textField); _upButton = new ImageButton { GridPositionX = 1, ContentVerticalAlignment = VerticalAlignment.Center, ContentHorizontalAlignment = HorizontalAlignment.Center }; _upButton.Up += UpButtonOnUp; Widgets.Add(_upButton); _downButton = new ImageButton { GridPositionX = 1, GridPositionY = 1, ContentVerticalAlignment = VerticalAlignment.Center, ContentHorizontalAlignment = HorizontalAlignment.Center }; _downButton.Up += DownButtonOnUp; Widgets.Add(_downButton); if (style != null) { ApplySpinButtonStyle(style); } Value = 0; }
public Dialog() { RowsProportions.Add(new Proportion()); var buttonsGrid = new Grid((GridStyle)null) { ColumnSpacing = 8, HorizontalAlignment = HorizontalAlignment.Right, GridPositionY = 2 }; buttonsGrid.ColumnsProportions.Add(new Proportion()); buttonsGrid.ColumnsProportions.Add(new Proportion()); ButtonOk = new Button { Text = "Ok" }; ButtonOk.Up += (sender, args) => { if (!CanCloseByOk()) { return; } Result = true; ModalResult = (int)DefaultModalResult.Ok; Close(); }; buttonsGrid.Widgets.Add(ButtonOk); ButtonCancel = new Button { Text = "Cancel", GridPositionX = 1 }; ButtonCancel.Up += (sender, args) => { Result = false; ModalResult = (int)DefaultModalResult.Cancel; Close(); }; buttonsGrid.Widgets.Add(ButtonCancel); Widgets.Add(buttonsGrid); }
private void AddItem(Widget menuItem, int index) { if (Orientation == Orientation.Horizontal) { ColumnsProportions.Add(new Proportion(ProportionType.Auto)); } else { menuItem.HorizontalAlignment = HorizontalAlignment.Stretch; menuItem.VerticalAlignment = VerticalAlignment.Stretch; RowsProportions.Add(new Proportion(ProportionType.Auto)); } Widgets.Insert(index, menuItem); UpdateGridPositions(); }
public Window(WindowStyle style) : base(style) { ModalResult = (int)DefaultModalResult.Cancel; Result = false; HorizontalAlignment = HorizontalAlignment.Left; VerticalAlignment = VerticalAlignment.Top; CanFocus = true; RowSpacing = 8; RowsProportions.Add(new Proportion(ProportionType.Auto)); RowsProportions.Add(new Proportion(ProportionType.Fill)); _titleGrid = new Grid { ColumnSpacing = 8 }; _titleGrid.ColumnsProportions.Add(new Proportion(ProportionType.Fill)); _titleGrid.ColumnsProportions.Add(new Proportion(ProportionType.Auto)); _titleLabel = new TextBlock(); _titleGrid.Widgets.Add(_titleLabel); _closeButton = new ImageButton { GridPositionX = 1 }; _closeButton.Up += (sender, args) => { Close(); }; _titleGrid.Widgets.Add(_closeButton); Widgets.Add(_titleGrid); if (style != null) { ApplyWindowStyle(style); } }
private void BuildUI() { BarLeft = new Panel(); BarLeft.Background = new SolidBrush("#213043FF"); BarLeft.Id = "BarLeft"; BarRight = new Panel(); BarRight.GridColumn = 1; BarRight.Background = new SolidBrush("#213043FF"); BarRight.Id = "BarRight"; var label1 = new Label(); label1.Text = "Pokemon Blue"; label1.Padding = new Thickness(35, 35, 0, 35); var PlayButton = new TextButton(); PlayButton.Text = "Play"; PlayButton.Margin = new Thickness(0, 23, 0, 0); PlayButton.Padding = new Thickness(40, 15, 40, 10); PlayButton.GridColumn = 1; PlayButton.Background = new SolidBrush("#743897FF"); PlayButton.TouchDown += PlayRom; var grid1 = new Grid(); grid1.ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); grid1.ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); //grid1.Widgets.Add(label1); grid1.Widgets.Add(PlayButton); var panel1 = new Panel(); panel1.Background = new SolidBrush("#162539"); panel1.Widgets.Add(grid1); var label2 = new Label(); label2.Text = "Your Library"; var panel2 = new Panel(); panel2.Margin = new Thickness(60); panel2.Background = new SolidBrush("#1D2F47FF"); panel2.Widgets.Add(label2); var verticalStackPanel1 = new VerticalStackPanel(); verticalStackPanel1.Widgets.Add(panel1); verticalStackPanel1.Widgets.Add(panel2); MainArea = new Panel(); MainArea.GridColumn = 1; MainArea.GridRow = 1; MainArea.Background = new SolidBrush("#1D2F47"); MainArea.Id = " MainArea"; MainArea.Widgets.Add(verticalStackPanel1); var textButton2 = new TextButton(); textButton2.Text = "Play"; textButton2.MinWidth = 500; textButton2.Padding = new Thickness(0, 29); textButton2.Background = new SolidBrush("#232B38FF"); var textButton3 = new TextButton(); textButton3.Text = "Joy Pad"; textButton3.MinWidth = 500; textButton3.Padding = new Thickness(0, 29); textButton3.Background = new SolidBrush("#232B38FF"); var textButton4 = new TextButton(); textButton4.Text = "System"; textButton4.MinWidth = 500; textButton4.Padding = new Thickness(0, 29); textButton4.Background = new SolidBrush("#232B38FF"); var textButton5 = new TextButton(); textButton5.Text = "About"; textButton5.MinWidth = 500; textButton5.Padding = new Thickness(0, 29); textButton5.Background = new SolidBrush("#232B38FF"); var verticalStackPanel2 = new VerticalStackPanel(); verticalStackPanel2.Widgets.Add(textButton2); verticalStackPanel2.Widgets.Add(textButton3); verticalStackPanel2.Widgets.Add(textButton4); verticalStackPanel2.Widgets.Add(textButton5); MenuBar = new Panel(); MenuBar.GridRow = 1; MenuBar.Background = new SolidBrush("#08111F"); MenuBar.Id = "MenuBar"; MenuBar.Widgets.Add(verticalStackPanel2); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, Value = 3, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, Value = 16, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, Value = 2, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, Value = 19, }); Widgets.Add(BarLeft); Widgets.Add(BarRight); Widgets.Add(MainArea); Widgets.Add(MenuBar); }
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; } }
private void BuildUI() { _checkBoxWidgetFrames = new CheckBox(); _checkBoxWidgetFrames.Text = "Draw green frame around every widget"; _checkBoxWidgetFrames.TextColor = Color.White; _checkBoxWidgetFrames.ImageWidthHint = 10; _checkBoxWidgetFrames.ImageHeightHint = 10; _checkBoxWidgetFrames.ImageVisible = true; _checkBoxWidgetFrames.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _checkBoxWidgetFrames.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _checkBoxWidgetFrames.Enabled = true; _checkBoxWidgetFrames.Id = "_checkBoxWidgetFrames"; _checkBoxWidgetFrames.XHint = 0; _checkBoxWidgetFrames.YHint = 0; _checkBoxWidgetFrames.WidthHint = null; _checkBoxWidgetFrames.HeightHint = null; _checkBoxWidgetFrames.PaddingLeft = 0; _checkBoxWidgetFrames.PaddingRight = 0; _checkBoxWidgetFrames.PaddingTop = 0; _checkBoxWidgetFrames.PaddingBottom = 0; _checkBoxWidgetFrames.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left; _checkBoxWidgetFrames.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Top; _checkBoxWidgetFrames.GridPositionX = 0; _checkBoxWidgetFrames.GridPositionY = 0; _checkBoxWidgetFrames.GridSpanX = 1; _checkBoxWidgetFrames.GridSpanY = 1; _checkBoxWidgetFrames.Visible = true; _checkBoxWidgetFrames.ClipToBounds = false; _checkBoxWidgetFrames.CanFocus = false; _checkBoxFocusedWidgetFrame = new CheckBox(); _checkBoxFocusedWidgetFrame.Text = "Draw red frame around the focused widget"; _checkBoxFocusedWidgetFrame.TextColor = Color.White; _checkBoxFocusedWidgetFrame.ImageWidthHint = 10; _checkBoxFocusedWidgetFrame.ImageHeightHint = 10; _checkBoxFocusedWidgetFrame.ImageVisible = true; _checkBoxFocusedWidgetFrame.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _checkBoxFocusedWidgetFrame.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _checkBoxFocusedWidgetFrame.Enabled = true; _checkBoxFocusedWidgetFrame.Id = "_checkBoxFocusedWidgetFrame"; _checkBoxFocusedWidgetFrame.XHint = 0; _checkBoxFocusedWidgetFrame.YHint = 0; _checkBoxFocusedWidgetFrame.WidthHint = null; _checkBoxFocusedWidgetFrame.HeightHint = null; _checkBoxFocusedWidgetFrame.PaddingLeft = 0; _checkBoxFocusedWidgetFrame.PaddingRight = 0; _checkBoxFocusedWidgetFrame.PaddingTop = 0; _checkBoxFocusedWidgetFrame.PaddingBottom = 0; _checkBoxFocusedWidgetFrame.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left; _checkBoxFocusedWidgetFrame.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Top; _checkBoxFocusedWidgetFrame.GridPositionX = 0; _checkBoxFocusedWidgetFrame.GridPositionY = 1; _checkBoxFocusedWidgetFrame.GridSpanX = 1; _checkBoxFocusedWidgetFrame.GridSpanY = 1; _checkBoxFocusedWidgetFrame.Visible = true; _checkBoxFocusedWidgetFrame.ClipToBounds = false; _checkBoxFocusedWidgetFrame.CanFocus = false; _checkBoxGlyphFrames = new CheckBox(); _checkBoxGlyphFrames.Text = "Draw white frame around every letter glyph"; _checkBoxGlyphFrames.TextColor = Color.White; _checkBoxGlyphFrames.ImageWidthHint = 10; _checkBoxGlyphFrames.ImageHeightHint = 10; _checkBoxGlyphFrames.ImageVisible = true; _checkBoxGlyphFrames.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _checkBoxGlyphFrames.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _checkBoxGlyphFrames.Enabled = true; _checkBoxGlyphFrames.Id = "_checkBoxGlyphFrames"; _checkBoxGlyphFrames.XHint = 0; _checkBoxGlyphFrames.YHint = 0; _checkBoxGlyphFrames.WidthHint = null; _checkBoxGlyphFrames.HeightHint = null; _checkBoxGlyphFrames.PaddingLeft = 0; _checkBoxGlyphFrames.PaddingRight = 0; _checkBoxGlyphFrames.PaddingTop = 0; _checkBoxGlyphFrames.PaddingBottom = 0; _checkBoxGlyphFrames.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left; _checkBoxGlyphFrames.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Top; _checkBoxGlyphFrames.GridPositionX = 0; _checkBoxGlyphFrames.GridPositionY = 2; _checkBoxGlyphFrames.GridSpanX = 1; _checkBoxGlyphFrames.GridSpanY = 1; _checkBoxGlyphFrames.Visible = true; _checkBoxGlyphFrames.ClipToBounds = false; _checkBoxGlyphFrames.CanFocus = false; _checkBoxDisableClipping = new CheckBox(); _checkBoxDisableClipping.Text = "Disable clipping"; _checkBoxDisableClipping.TextColor = Color.White; _checkBoxDisableClipping.ImageWidthHint = 10; _checkBoxDisableClipping.ImageHeightHint = 10; _checkBoxDisableClipping.ImageVisible = true; _checkBoxDisableClipping.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _checkBoxDisableClipping.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _checkBoxDisableClipping.Enabled = true; _checkBoxDisableClipping.Id = "_checkBoxDisableClipping"; _checkBoxDisableClipping.XHint = 0; _checkBoxDisableClipping.YHint = 0; _checkBoxDisableClipping.WidthHint = null; _checkBoxDisableClipping.HeightHint = null; _checkBoxDisableClipping.PaddingLeft = 0; _checkBoxDisableClipping.PaddingRight = 0; _checkBoxDisableClipping.PaddingTop = 0; _checkBoxDisableClipping.PaddingBottom = 0; _checkBoxDisableClipping.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left; _checkBoxDisableClipping.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Top; _checkBoxDisableClipping.GridPositionX = 0; _checkBoxDisableClipping.GridPositionY = 3; _checkBoxDisableClipping.GridSpanX = 1; _checkBoxDisableClipping.GridSpanY = 1; _checkBoxDisableClipping.Visible = true; _checkBoxDisableClipping.ClipToBounds = false; _checkBoxDisableClipping.CanFocus = false; DrawLines = false; DrawLinesColor = Color.White; ColumnSpacing = 0; RowSpacing = 0; RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Auto, Value = 1, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Auto, Value = 1, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Auto, Value = 1, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Auto, Value = 1, }); TotalRowsPart = null; TotalColumnsPart = null; Enabled = true; Id = "Root"; XHint = 0; YHint = 0; WidthHint = null; HeightHint = null; PaddingLeft = 0; PaddingRight = 0; PaddingTop = 0; PaddingBottom = 0; HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; GridPositionX = 0; GridPositionY = 0; GridSpanX = 1; GridSpanY = 1; Visible = true; ClipToBounds = false; CanFocus = false; Widgets.Add(_checkBoxWidgetFrames); Widgets.Add(_checkBoxFocusedWidgetFrame); Widgets.Add(_checkBoxGlyphFrames); Widgets.Add(_checkBoxDisableClipping); }
private void BuildUI() { var label1 = new Label(); label1.Text = "Blackhole"; label1.Font = GameManager.Content.Load <SpriteFont>("Fonts/Iceberg32"); label1.DisabledTextColor = Color.White; label1.OverTextColor = new Color { B = 255, G = 255, R = 255, A = 0, }; label1.Margin = new Thickness(0, 20, 0, 0); label1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label1.OverBackground = new SolidBrush("#00000000"); var textBox1 = new TextBox(); textBox1.Text = "Username"; textBox1.Font = GameManager.Content.Load <SpriteFont>("Fonts/Iceberg24"); textBox1.TextVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; textBox1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; textBox1.Width = 200; textBox1.Height = 40; textBox1.Background = new SolidBrush("#1C1C1CFF"); var textBox2 = new TextBox(); textBox2.Text = "Password"; textBox2.Font = GameManager.Content.Load <SpriteFont>("Fonts/Iceberg24"); textBox2.PasswordField = true; textBox2.TextVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; textBox2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; textBox2.Width = 200; textBox2.Height = 40; textBox2.Margin = new Thickness(0, 45, 0, 0); textBox2.GridRow = 1; textBox2.Background = new SolidBrush("#1C1C1FFF"); LoginButton = new TextButton(); LoginButton.Text = "Login"; LoginButton.Font = GameManager.Content.Load <SpriteFont>("Fonts/Iceberg24"); LoginButton.Width = 200; LoginButton.Height = 40; LoginButton.Margin = new Thickness(0, 90, 0, 0); LoginButton.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; LoginButton.GridRow = 2; var panel1 = new Panel(); panel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; panel1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; panel1.Margin = new Thickness(0, 50, 0, 0); panel1.BorderThickness = new Thickness(1); panel1.Padding = new Thickness(20); panel1.GridColumn = 1; panel1.Background = new SolidBrush("#000000FF"); panel1.Border = new SolidBrush("#FFFFFFFF"); panel1.Widgets.Add(textBox1); panel1.Widgets.Add(textBox2); panel1.Widgets.Add(LoginButton); var panel2 = new Panel(); panel2.BorderThickness = new Thickness(2); panel2.GridColumn = 1; panel2.GridRow = 1; panel2.Background = new SolidBrush("#0F002DFF"); panel2.Border = new SolidBrush("#FFFFFFFF"); panel2.Widgets.Add(label1); panel2.Widgets.Add(panel1); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Pixels, Value = 400, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Pixels, Value = 300, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); Widgets.Add(panel2); }
private void BuildUI() { menuItemNew = new MenuItem(); menuItemNew.Id = "menuItemNew"; menuItemNew.Text = "New"; menuItemOpen = new MenuItem(); menuItemOpen.Id = "menuItemOpen"; menuItemOpen.Text = "Open..."; menuItemSave = new MenuItem(); menuItemSave.Id = "menuItemSave"; menuItemSave.Text = "Save"; menuItemSaveAs = new MenuItem(); menuItemSaveAs.Id = "menuItemSaveAs"; menuItemSaveAs.Text = "Save As..."; var menuSeparator1 = new MenuSeparator(); menuItemQuit = new MenuItem(); menuItemQuit.Id = "menuItemQuit"; menuItemQuit.Text = "Quit"; menuItemFile = new MenuItem(); menuItemFile.Id = "menuItemFile"; menuItemFile.Text = "File"; menuItemFile.Items.Add(menuItemNew); menuItemFile.Items.Add(menuItemOpen); menuItemFile.Items.Add(menuItemSave); menuItemFile.Items.Add(menuItemSaveAs); menuItemFile.Items.Add(menuSeparator1); menuItemFile.Items.Add(menuItemQuit); menuItemAbout = new MenuItem(); menuItemAbout.Id = "menuItemAbout"; menuItemAbout.Text = "About"; menuItemHelp = new MenuItem(); menuItemHelp.Id = "menuItemHelp"; menuItemHelp.Text = "Help"; menuItemHelp.Items.Add(menuItemAbout); mainMenu = new HorizontalMenu(); mainMenu.DrawLinesColor = Color.White; mainMenu.Id = "mainMenu"; mainMenu.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; mainMenu.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; mainMenu.Items.Add(menuItemFile); mainMenu.Items.Add(menuItemHelp); textArea = new TextField(); textArea.Text = ""; textArea.Multiline = true; textArea.Id = "textArea"; textArea.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; textArea.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; textArea.CanFocus = true; var scrollPane1 = new ScrollPane(); scrollPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; scrollPane1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; scrollPane1.GridPositionY = 1; scrollPane1.ClipToBounds = true; scrollPane1.CanFocus = true; scrollPane1.Child = textArea; DrawLinesColor = Color.White; RowsProportions.Add(new Grid.Proportion()); RowsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); Id = "Root"; HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; Widgets.Add(mainMenu); Widgets.Add(scrollPane1); }
public GridTabPage() { RowSpacing = 3; ColumnSpacing = 3; ColumnsProportions.Add(new Proportion(ProportionType.Auto)); ColumnsProportions.Add(new Proportion(ProportionType.Auto)); ColumnsProportions.Add(new Proportion(ProportionType.Part, 1.0f)); ColumnsProportions.Add(new Proportion(ProportionType.Part, 2.0f)); ColumnsProportions.Add(new Proportion(ProportionType.Pixels, 150.0f)); ColumnsProportions.Add(new Proportion(ProportionType.Auto)); ColumnsProportions.Add(new Proportion(ProportionType.Fill)); RowsProportions.Add(new Proportion(ProportionType.Auto)); RowsProportions.Add(new Proportion(ProportionType.Auto)); RowsProportions.Add(new Proportion(ProportionType.Part, 1.0f)); RowsProportions.Add(new Proportion(ProportionType.Part, 1.0f)); RowsProportions.Add(new Proportion(ProportionType.Pixels, 200.0f)); RowsProportions.Add(new Proportion(ProportionType.Auto)); RowsProportions.Add(new Proportion(ProportionType.Fill)); // Create headers for (var i = 1; i < ColumnsProportions.Count; ++i) { var header = new TextBlock { Text = ColumnsProportions[i].ToString(), GridColumn = i, GridRow = 0 }; Widgets.Add(header); } // Combo var combo = new ComboBox { GridColumn = 1, GridRow = 1 }; combo.Items.Add(new ListItem("Red", Color.Red)); combo.Items.Add(new ListItem("Green", Color.Green)); combo.Items.Add(new ListItem("Blue", Color.Blue)); Widgets.Add(combo); // Button var button = new Button { GridColumn = 2, GridRow = 1, GridColumnSpan = 2, GridRowSpan = 1, HorizontalAlignment = HorizontalAlignment.Stretch, Text = "This is 2 columns button" }; button.Click += (s, a) => { var messageBox = Dialog.CreateMessageBox("2C", "2 Columns Button pushed!"); messageBox.ShowModal(Desktop); }; Widgets.Add(button); // Button var button2 = new Button { GridColumn = 2, GridRow = 2, GridColumnSpan = 1, GridRowSpan = 2, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Text = "This is 2 rows button" }; button2.Click += (s, a) => { var messageBox = Dialog.CreateMessageBox("2R", "2 Rows Button pushed!"); messageBox.ShowModal(Desktop); }; Widgets.Add(button2); var label = new TextBlock { Text = "Lorem ipsum [Green]dolor sit amet, [Red]consectetur adipisicing elit, sed do eiusmod [#AAAAAAAA]tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. [white]Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum!", VerticalSpacing = 0, TextColor = Color.AntiqueWhite, Wrap = true }; var pane = new ScrollPane { Widget = label, Width = 200, Height = 200 }; _window = new Window { Title = "Text", Content = pane }; var button3 = new Button { Text = "Show Window", GridColumn = 4, GridRow = 3 }; Widgets.Add(button3); button3.Click += (sender, args) => { _window.ShowModal(Desktop); }; // Horizontal slider var hslider = new HorizontalSlider { GridColumn = 3, GridRow = 2 }; Widgets.Add(hslider); // Horizontal slider value var hsliderValue = new TextBlock { GridColumn = 4, GridRow = 2, Text = "HSlider Value: 0" }; hslider.ValueChanged += (sender, args) => { hsliderValue.Text = string.Format("HSlider Value: {0:0.00}", hslider.Value); }; Widgets.Add(hsliderValue); var textBlock = new TextBlock { Width = 125, Text = "This is textblock which spans for several lines to demonstrate row proportion set to Auto", GridColumn = 4, GridRow = 1 }; Widgets.Add(textBlock); var checkBox = new CheckBox { Text = "This is a checkbox", GridColumn = 3, GridRow = 3, }; Widgets.Add(checkBox); // Spin buttons var textField = new TextField { GridColumn = 5, GridRow = 1, Width = 100 }; Widgets.Add(textField); var spinButton2 = new SpinButton { GridColumn = 5, GridRow = 2, Width = 100, Integer = true }; Widgets.Add(spinButton2); // Progress bars var horizontalProgressBar = new HorizontalProgressBar { GridColumn = 5, GridRow = 3, Width = 100 }; Widgets.Add(horizontalProgressBar); var verticalProgressBar = new VerticalProgressBar { GridColumn = 6, GridRow = 1, Height = 100 }; Widgets.Add(verticalProgressBar); // List box var list = new ListBox { GridColumn = 5, GridRow = 4 }; list.Items.Add(new ListItem("Red", Color.Red)); list.Items.Add(new ListItem("Green", Color.Green)); list.Items.Add(new ListItem("Blue", Color.Blue)); Widgets.Add(list); // Vertical slider var vslider = new VerticalSlider { GridColumn = 2, GridRow = 4 }; Widgets.Add(vslider); // Vertical slider value var vsliderValue = new TextBlock { GridColumn = 4, GridRow = 4, Text = "VSlider Value: 0" }; vslider.ValueChanged += (sender, args) => { vsliderValue.Text = string.Format("VSlider Value: {0:0.00}", vslider.Value); }; Widgets.Add(vsliderValue); var tree = new Tree { HasRoot = false, GridColumn = 3, GridRow = 4 }; var node1 = tree.AddSubNode("node1"); var node2 = node1.AddSubNode("node2"); var node3 = node2.AddSubNode("node3"); node3.AddSubNode("node4"); node3.AddSubNode("node5"); node2.AddSubNode("node6"); Widgets.Add(tree); var textBlock2 = new TextBlock { Text = "This is long textblock", GridColumn = 1, GridRow = 4 }; Widgets.Add(textBlock2); var hsplitPane = new HorizontalSplitPane { GridColumn = 1, GridRow = 5 }; var hsplitPaneLabel1 = new TextBlock { Text = "Left" }; hsplitPane.Widgets.Add(hsplitPaneLabel1); var hsplitPaneLabel2 = new TextBlock { Text = "Right" }; hsplitPane.Widgets.Add(hsplitPaneLabel2); Widgets.Add(hsplitPane); var vsplitPane = new VerticalSplitPane { GridColumn = 6, GridRow = 4 }; var vsplitPaneLabel1 = new TextBlock { Text = "Top" }; vsplitPane.Widgets.Add(vsplitPaneLabel1); var vsplitPaneLabel2 = new TextBlock { Text = "Bottom" }; vsplitPane.Widgets.Add(vsplitPaneLabel2); Widgets.Add(vsplitPane); for (var i = 1; i < RowsProportions.Count; ++i) { var header = new TextBlock { Text = RowsProportions[i].ToString(), GridColumn = 0, GridRow = i }; Widgets.Add(header); } }
private void BuildUI() { _menuFileNew = new MenuItem(); _menuFileNew.Id = "_menuFileNew"; _menuFileNew.Text = "&New"; _menuFileOpen = new MenuItem(); _menuFileOpen.Id = "_menuFileOpen"; _menuFileOpen.Text = "&Open"; _menuFileSave = new MenuItem(); _menuFileSave.Id = "_menuFileSave"; _menuFileSave.Text = "&Save"; _menuFileSaveAs = new MenuItem(); _menuFileSaveAs.Id = "_menuFileSaveAs"; _menuFileSaveAs.Text = "Save &As..."; _menuFileExportToCS = new MenuItem(); _menuFileExportToCS.Id = "_menuFileExportToCS"; _menuFileExportToCS.Text = "&Export To C#..."; var menuSeparator1 = new MenuSeparator(); _menuFileDebugOptions = new MenuItem(); _menuFileDebugOptions.Id = "_menuFileDebugOptions"; _menuFileDebugOptions.Text = "&UI Debug Options"; var menuSeparator2 = new MenuSeparator(); _menuFileQuit = new MenuItem(); _menuFileQuit.Id = "_menuFileQuit"; _menuFileQuit.Text = "&Quit"; var menuItem1 = new MenuItem(); menuItem1.Id = ""; menuItem1.Text = "&File"; menuItem1.Items.Add(_menuFileNew); menuItem1.Items.Add(_menuFileOpen); menuItem1.Items.Add(_menuFileSave); menuItem1.Items.Add(_menuFileSaveAs); menuItem1.Items.Add(_menuFileExportToCS); menuItem1.Items.Add(menuSeparator1); menuItem1.Items.Add(_menuFileDebugOptions); menuItem1.Items.Add(menuSeparator2); menuItem1.Items.Add(_menuFileQuit); _menuControlsAddButton = new MenuItem(); _menuControlsAddButton.Id = "_menuControlsAddButton"; _menuControlsAddButton.Text = "Add Button"; _menuControlsAddCheckBox = new MenuItem(); _menuControlsAddCheckBox.Id = "_menuControlsAddCheckBox"; _menuControlsAddCheckBox.Text = "Add CheckBox"; _menuControlsAddImageButton = new MenuItem(); _menuControlsAddImageButton.Id = "_menuControlsAddImageButton"; _menuControlsAddImageButton.Text = "Add ImageButton"; _menuControlsAddTextButton = new MenuItem(); _menuControlsAddTextButton.Id = "_menuControlsAddTextButton"; _menuControlsAddTextButton.Text = "Add TextButton"; _menuControlsAddHorizontalSlider = new MenuItem(); _menuControlsAddHorizontalSlider.Id = "_menuControlsAddHorizontalSlider"; _menuControlsAddHorizontalSlider.Text = "Add HorizontalSlider"; _menuControlsAddVerticalSlider = new MenuItem(); _menuControlsAddVerticalSlider.Id = "_menuControlsAddVerticalSlider"; _menuControlsAddVerticalSlider.Text = "Add VerticalSlider"; _menuControlsAddHorizontalProgressBar = new MenuItem(); _menuControlsAddHorizontalProgressBar.Id = "_menuControlsAddHorizontalProgressBar"; _menuControlsAddHorizontalProgressBar.Text = "Add Horizontal ProgressBar"; _menuControlsAddVerticalProgressBar = new MenuItem(); _menuControlsAddVerticalProgressBar.Id = "_menuControlsAddVerticalProgressBar"; _menuControlsAddVerticalProgressBar.Text = "Add Vertical ProgressBar"; _menuControlsAddComboBox = new MenuItem(); _menuControlsAddComboBox.Id = "_menuControlsAddComboBox"; _menuControlsAddComboBox.Text = "Add ComboBox"; _menuControlsAddListBox = new MenuItem(); _menuControlsAddListBox.Id = "_menuControlsAddListBox"; _menuControlsAddListBox.Text = "Add ListBox"; _menuControlsAddImage = new MenuItem(); _menuControlsAddImage.Id = "_menuControlsAddImage"; _menuControlsAddImage.Text = "Add Image"; _menuControlsAddTextBlock = new MenuItem(); _menuControlsAddTextBlock.Id = "_menuControlsAddTextBlock"; _menuControlsAddTextBlock.Text = "Add TextBlock"; _menuControlsAddTextField = new MenuItem(); _menuControlsAddTextField.Id = "_menuControlsAddTextField"; _menuControlsAddTextField.Text = "Add TextField"; _menuControlsAddSpinButton = new MenuItem(); _menuControlsAddSpinButton.Id = "_menuControlsAddSpinButton"; _menuControlsAddSpinButton.Text = "Add SpinButton"; var menuSeparator3 = new MenuSeparator(); _menuControlsAddPanel = new MenuItem(); _menuControlsAddPanel.Id = "_menuControlsAddPanel"; _menuControlsAddPanel.Text = "Add Panel"; _menuControlsAddGrid = new MenuItem(); _menuControlsAddGrid.Id = "_menuControlsAddGrid"; _menuControlsAddGrid.Text = "Add Grid"; _menuControlsAddScrollPane = new MenuItem(); _menuControlsAddScrollPane.Id = "_menuControlsAddScrollPane"; _menuControlsAddScrollPane.Text = "Add ScrollPane"; _menuControlsAddHorizontalSplitPane = new MenuItem(); _menuControlsAddHorizontalSplitPane.Id = "_menuControlsAddHorizontalSplitPane"; _menuControlsAddHorizontalSplitPane.Text = "Add Horizontal SplitPane"; _menuControlsAddVerticalSplitPane = new MenuItem(); _menuControlsAddVerticalSplitPane.Id = "_menuControlsAddVerticalSplitPane"; _menuControlsAddVerticalSplitPane.Text = "Add Vertical SplitPane"; var menuSeparator4 = new MenuSeparator(); _menuControlsAddHorizontalMenu = new MenuItem(); _menuControlsAddHorizontalMenu.Id = "_menuControlsAddHorizontalMenu"; _menuControlsAddHorizontalMenu.Text = "Add HorizontalMenu"; _menuControlsAddVerticalMenu = new MenuItem(); _menuControlsAddVerticalMenu.Id = "_menuControlsAddVerticalMenu"; _menuControlsAddVerticalMenu.Text = "Add Vertical Menu"; _menuControlsAddMenuItem = new MenuItem(); _menuControlsAddMenuItem.Id = "_menuControlsAddMenuItem"; _menuControlsAddMenuItem.Text = "Add Menu Item"; _menuControlsAddMenuSeparator = new MenuItem(); _menuControlsAddMenuSeparator.Id = "_menuControlsAddMenuSeparator"; _menuControlsAddMenuSeparator.Text = "Add Menu Separator"; _menuControls = new MenuItem(); _menuControls.Id = "_menuControls"; _menuControls.Text = "&Controls"; _menuControls.Items.Add(_menuControlsAddButton); _menuControls.Items.Add(_menuControlsAddCheckBox); _menuControls.Items.Add(_menuControlsAddImageButton); _menuControls.Items.Add(_menuControlsAddTextButton); _menuControls.Items.Add(_menuControlsAddHorizontalSlider); _menuControls.Items.Add(_menuControlsAddVerticalSlider); _menuControls.Items.Add(_menuControlsAddHorizontalProgressBar); _menuControls.Items.Add(_menuControlsAddVerticalProgressBar); _menuControls.Items.Add(_menuControlsAddComboBox); _menuControls.Items.Add(_menuControlsAddListBox); _menuControls.Items.Add(_menuControlsAddImage); _menuControls.Items.Add(_menuControlsAddTextBlock); _menuControls.Items.Add(_menuControlsAddTextField); _menuControls.Items.Add(_menuControlsAddSpinButton); _menuControls.Items.Add(menuSeparator3); _menuControls.Items.Add(_menuControlsAddPanel); _menuControls.Items.Add(_menuControlsAddGrid); _menuControls.Items.Add(_menuControlsAddScrollPane); _menuControls.Items.Add(_menuControlsAddHorizontalSplitPane); _menuControls.Items.Add(_menuControlsAddVerticalSplitPane); _menuControls.Items.Add(menuSeparator4); _menuControls.Items.Add(_menuControlsAddHorizontalMenu); _menuControls.Items.Add(_menuControlsAddVerticalMenu); _menuControls.Items.Add(_menuControlsAddMenuItem); _menuControls.Items.Add(_menuControlsAddMenuSeparator); _menuHelpAbout = new MenuItem(); _menuHelpAbout.Id = "_menuHelpAbout"; _menuHelpAbout.Text = "&About"; var menuItem2 = new MenuItem(); menuItem2.Id = ""; menuItem2.Text = "&Help"; menuItem2.Items.Add(_menuHelpAbout); var horizontalMenu1 = new HorizontalMenu(); horizontalMenu1.DrawLinesColor = Color.White; horizontalMenu1.Id = ""; horizontalMenu1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; horizontalMenu1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; horizontalMenu1.Items.Add(menuItem1); horizontalMenu1.Items.Add(_menuControls); horizontalMenu1.Items.Add(menuItem2); _projectHolder = new Panel(); _projectHolder.Id = "_projectHolder"; _projectHolder.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _projectHolder.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _explorerHolder = new Panel(); _explorerHolder.Id = "_explorerHolder"; _explorerHolder.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _explorerHolder.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _propertyGridPane = new ScrollPane(); _propertyGridPane.Id = "_propertyGridPane"; _propertyGridPane.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _propertyGridPane.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _propertyGridPane.GridPositionY = 2; _propertyGridPane.ClipToBounds = true; _propertyGridPane.CanFocus = true; _rightSplitPane = new VerticalSplitPane(); _rightSplitPane.Id = "_rightSplitPane"; _rightSplitPane.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _rightSplitPane.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _rightSplitPane.GridPositionX = 2; _rightSplitPane.Widgets.Add(_explorerHolder); _rightSplitPane.Widgets.Add(_propertyGridPane); _topSplitPane = new HorizontalSplitPane(); _topSplitPane.Id = "_topSplitPane"; _topSplitPane.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _topSplitPane.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _topSplitPane.GridPositionY = 1; _topSplitPane.Widgets.Add(_projectHolder); _topSplitPane.Widgets.Add(_rightSplitPane); DrawLinesColor = Color.White; RowsProportions.Add(new Proportion()); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); Id = "Root"; HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; Widgets.Add(horizontalMenu1); Widgets.Add(_topSplitPane); }
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); }
private void BuildUI() { _menuFileNew = new MenuItem(); _menuFileNew.Id = "_menuFileNew"; _menuFileNew.Text = "&New"; _menuFileOpen = new MenuItem(); _menuFileOpen.Id = "_menuFileOpen"; _menuFileOpen.Text = "&Open"; _menuFileSave = new MenuItem(); _menuFileSave.Id = "_menuFileSave"; _menuFileSave.Text = "&Save"; var menuSeparator1 = new MenuSeparator(); _menuFileDebugOptions = new MenuItem(); _menuFileDebugOptions.Id = "_menuFileDebugOptions"; _menuFileDebugOptions.Text = "&UI Debug Options"; var menuSeparator2 = new MenuSeparator(); _quitMenuItem = new MenuItem(); _quitMenuItem.Id = "_quitMenuItem"; _quitMenuItem.Text = "&Quit"; var menuItem1 = new MenuItem(); menuItem1.Id = ""; menuItem1.Text = "&File"; menuItem1.Items.Add(_menuFileNew); menuItem1.Items.Add(_menuFileOpen); menuItem1.Items.Add(_menuFileSave); menuItem1.Items.Add(menuSeparator1); menuItem1.Items.Add(_menuFileDebugOptions); menuItem1.Items.Add(menuSeparator2); menuItem1.Items.Add(_quitMenuItem); _menuControlsAddTileInfo = new MenuItem(); _menuControlsAddTileInfo.Id = "_menuControlsAddTileInfo"; _menuControlsAddTileInfo.Text = "Add &Tile Info"; _menuControlsAddCreatureInfo = new MenuItem(); _menuControlsAddCreatureInfo.Id = "_menuControlsAddCreatureInfo"; _menuControlsAddCreatureInfo.Text = "Add &Creature Info"; _menuControlsAddMap = new MenuItem(); _menuControlsAddMap.Id = "_menuControlsAddMap"; _menuControlsAddMap.Text = "Add &Map"; _menuItems = new MenuItem(); _menuItems.Id = "_menuItems"; _menuItems.Text = "&Items"; _menuItems.Items.Add(_menuControlsAddTileInfo); _menuItems.Items.Add(_menuControlsAddCreatureInfo); _menuItems.Items.Add(_menuControlsAddMap); _aboutMenuItem = new MenuItem(); _aboutMenuItem.Id = "_aboutMenuItem"; _aboutMenuItem.Text = "&About"; var menuItem2 = new MenuItem(); menuItem2.Id = ""; menuItem2.Text = "&Help"; menuItem2.Items.Add(_aboutMenuItem); _mainMenu = new HorizontalMenu(); _mainMenu.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _mainMenu.Id = "_mainMenu"; _mainMenu.CanFocus = true; _mainMenu.Items.Add(menuItem1); _mainMenu.Items.Add(_menuItems); _mainMenu.Items.Add(menuItem2); _leftContainer = new Panel(); _leftContainer.Id = "_leftContainer"; _explorerContainer = new Panel(); _explorerContainer.Id = "_explorerContainer"; _rightSplitPane = new VerticalSplitPane(); _rightSplitPane.Id = "_rightSplitPane"; _rightSplitPane.GridColumn = 2; _rightSplitPane.GridRow = 1; _rightSplitPane.Widgets.Add(_explorerContainer); _topSplitPane = new HorizontalSplitPane(); _topSplitPane.Id = "_topSplitPane"; _topSplitPane.GridRow = 1; _topSplitPane.Widgets.Add(_leftContainer); _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(_mainMenu); Widgets.Add(_topSplitPane); }
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); }
private void BuildUI() { gridcontent_label = new Label(); gridcontent_label.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); gridcontent_label.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; gridcontent_label.Padding = new Thickness(5, 0); gridcontent_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; gridcontent_label.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; gridcontent_label.Visible = false; gridcontent_label.Id = "gridcontent_label"; gridfirstcolumn_label = new Label(); gridfirstcolumn_label.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); gridfirstcolumn_label.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; gridfirstcolumn_label.TextColor = Color.Black; gridfirstcolumn_label.Padding = new Thickness(5, 0); gridfirstcolumn_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; gridfirstcolumn_label.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; gridfirstcolumn_label.Visible = false; gridfirstcolumn_label.Background = new SolidBrush("#FFFFFFFF"); gridfirstcolumn_label.Id = "gridfirstcolumn_label"; gridfirstrowmovablecolumns_label = new Label(); gridfirstrowmovablecolumns_label.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); gridfirstrowmovablecolumns_label.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; gridfirstrowmovablecolumns_label.TextColor = Color.Black; gridfirstrowmovablecolumns_label.BorderThickness = new Thickness(0, 0, 0, 1); gridfirstrowmovablecolumns_label.Padding = new Thickness(5, 0); gridfirstrowmovablecolumns_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; gridfirstrowmovablecolumns_label.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; gridfirstrowmovablecolumns_label.Visible = false; gridfirstrowmovablecolumns_label.Background = new SolidBrush("#FFFFFFFF"); gridfirstrowmovablecolumns_label.Border = new SolidBrush("#000000FF"); gridfirstrowmovablecolumns_label.Id = "gridfirstrowmovablecolumns_label"; graycell_label = new Label(); graycell_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; graycell_label.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; graycell_label.Visible = false; graycell_label.Background = new SolidBrush("#404040FF"); graycell_label.Id = "graycell_label"; var label1 = new Label(); label1.Text = "Joueurs"; label1.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label1.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label1.TextColor = Color.Black; label1.BorderThickness = new Thickness(0, 0, 0, 1); label1.Padding = new Thickness(5, 0); label1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label1.Border = new SolidBrush("#000000FF"); var label2 = new Label(); label2.Text = "Couleur"; label2.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label2.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label2.TextColor = Color.Black; label2.BorderThickness = new Thickness(0, 0, 0, 1); label2.Padding = new Thickness(5, 0); label2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label2.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label2.GridColumn = 1; label2.Border = new SolidBrush("#000000FF"); var label3 = new Label(); label3.Text = "↑ ou ↓"; label3.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label3.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label3.TextColor = Color.Black; label3.BorderThickness = new Thickness(0, 0, 0, 1); label3.Padding = new Thickness(5, 0); label3.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label3.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label3.GridColumn = 2; label3.Border = new SolidBrush("#000000FF"); var label4 = new Label(); label4.Text = "↔ ou ↕"; label4.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label4.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label4.TextColor = Color.Black; label4.BorderThickness = new Thickness(0, 0, 0, 1); label4.Padding = new Thickness(5, 0); label4.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label4.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label4.GridColumn = 3; label4.Border = new SolidBrush("#000000FF"); var label5 = new Label(); label5.Text = "Suite"; label5.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label5.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label5.TextColor = Color.Black; label5.BorderThickness = new Thickness(0, 0, 0, 1); label5.Padding = new Thickness(5, 0); label5.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label5.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label5.GridColumn = 4; label5.Border = new SolidBrush("#000000FF"); movecolumnleft_button = new TextButton(); movecolumnleft_button.Text = "◄"; movecolumnleft_button.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); movecolumnleft_button.BorderThickness = new Thickness(0, 0, 0, 1); movecolumnleft_button.Padding = new Thickness(3, 0); movecolumnleft_button.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; movecolumnleft_button.GridColumn = 5; movecolumnleft_button.Border = new SolidBrush("#404040FF"); movecolumnleft_button.Id = "movecolumnleft_button"; movecolumnright_button = new TextButton(); movecolumnright_button.Text = "►"; movecolumnright_button.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); movecolumnright_button.BorderThickness = new Thickness(0, 0, 0, 1); movecolumnright_button.Padding = new Thickness(3, 0); movecolumnright_button.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; movecolumnright_button.GridColumn = 6; movecolumnright_button.Border = new SolidBrush("#404040FF"); movecolumnright_button.Id = "movecolumnright_button"; var label6 = new Label(); label6.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label6.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label6.TextColor = Color.Black; label6.BorderThickness = new Thickness(0, 0, 0, 1); label6.Padding = new Thickness(5, 0); label6.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label6.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label6.GridColumn = 7; label6.Border = new SolidBrush("#000000FF"); var label7 = new Label(); label7.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label7.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label7.TextColor = Color.Black; label7.BorderThickness = new Thickness(0, 0, 0, 1); label7.Padding = new Thickness(5, 0); label7.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label7.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label7.GridColumn = 8; label7.Border = new SolidBrush("#000000FF"); var label8 = new Label(); label8.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label8.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label8.TextColor = Color.Black; label8.BorderThickness = new Thickness(0, 0, 0, 1); label8.Padding = new Thickness(5, 0); label8.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label8.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label8.GridColumn = 9; label8.Border = new SolidBrush("#000000FF"); var label9 = new Label(); label9.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label9.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label9.TextColor = Color.Black; label9.BorderThickness = new Thickness(0, 0, 0, 1); label9.Padding = new Thickness(5, 0); label9.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label9.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label9.GridColumn = 10; label9.Border = new SolidBrush("#000000FF"); var label10 = new Label(); label10.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label10.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label10.TextColor = Color.Black; label10.BorderThickness = new Thickness(0, 0, 0, 1); label10.Padding = new Thickness(5, 0); label10.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label10.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label10.GridColumn = 11; label10.Border = new SolidBrush("#000000FF"); var label11 = new Label(); label11.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label11.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label11.TextColor = Color.Black; label11.BorderThickness = new Thickness(0, 0, 0, 1); label11.Padding = new Thickness(5, 0); label11.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label11.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label11.GridColumn = 12; label11.Border = new SolidBrush("#000000FF"); var label12 = new Label(); label12.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label12.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label12.TextColor = Color.Black; label12.BorderThickness = new Thickness(0, 0, 0, 1); label12.Padding = new Thickness(5, 0); label12.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label12.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label12.GridColumn = 13; label12.Border = new SolidBrush("#000000FF"); var label13 = new Label(); label13.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label13.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label13.TextColor = Color.Black; label13.BorderThickness = new Thickness(0, 0, 0, 1); label13.Padding = new Thickness(5, 0); label13.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label13.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label13.GridColumn = 14; label13.Border = new SolidBrush("#000000FF"); var label14 = new Label(); label14.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label14.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label14.TextColor = Color.Black; label14.BorderThickness = new Thickness(0, 0, 0, 1); label14.Padding = new Thickness(5, 0); label14.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label14.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label14.GridColumn = 15; label14.Border = new SolidBrush("#000000FF"); var label15 = new Label(); label15.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label15.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label15.TextColor = Color.Black; label15.BorderThickness = new Thickness(0, 0, 0, 1); label15.Padding = new Thickness(5, 0); label15.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label15.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label15.GridColumn = 16; label15.Border = new SolidBrush("#000000FF"); var label16 = new Label(); label16.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label16.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; label16.TextColor = Color.Black; label16.BorderThickness = new Thickness(0, 0, 0, 1); label16.Padding = new Thickness(5, 0); label16.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label16.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label16.GridColumn = 17; label16.Border = new SolidBrush("#000000FF"); var label17 = new Label(); label17.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label17.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label17.GridColumn = 5; label17.GridRow = 1; label17.Background = new SolidBrush("#404040FF"); var label18 = new Label(); label18.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label18.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label18.GridColumn = 5; label18.GridRow = 2; label18.Background = new SolidBrush("#404040FF"); var label19 = new Label(); label19.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label19.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label19.GridColumn = 5; label19.GridRow = 3; label19.Background = new SolidBrush("#404040FF"); var label20 = new Label(); label20.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label20.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label20.GridColumn = 5; label20.GridRow = 4; label20.Background = new SolidBrush("#404040FF"); var label21 = new Label(); label21.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label21.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label21.GridColumn = 5; label21.GridRow = 5; label21.Background = new SolidBrush("#404040FF"); var label22 = new Label(); label22.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label22.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label22.GridColumn = 5; label22.GridRow = 6; label22.Background = new SolidBrush("#404040FF"); var label23 = new Label(); label23.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label23.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label23.GridColumn = 5; label23.GridRow = 7; label23.Background = new SolidBrush("#404040FF"); var label24 = new Label(); label24.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label24.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label24.GridColumn = 5; label24.GridRow = 8; label24.Background = new SolidBrush("#404040FF"); var label25 = new Label(); label25.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label25.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label25.GridColumn = 5; label25.GridRow = 9; label25.Background = new SolidBrush("#404040FF"); var label26 = new Label(); label26.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label26.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label26.GridColumn = 5; label26.GridRow = 10; label26.Background = new SolidBrush("#404040FF"); var label27 = new Label(); label27.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label27.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label27.GridColumn = 6; label27.GridRow = 1; label27.Background = new SolidBrush("#404040FF"); var label28 = new Label(); label28.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label28.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label28.GridColumn = 6; label28.GridRow = 2; label28.Background = new SolidBrush("#404040FF"); var label29 = new Label(); label29.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label29.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label29.GridColumn = 6; label29.GridRow = 3; label29.Background = new SolidBrush("#404040FF"); var label30 = new Label(); label30.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label30.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label30.GridColumn = 6; label30.GridRow = 4; label30.Background = new SolidBrush("#404040FF"); var label31 = new Label(); label31.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label31.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label31.GridColumn = 6; label31.GridRow = 5; label31.Background = new SolidBrush("#404040FF"); var label32 = new Label(); label32.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label32.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label32.GridColumn = 6; label32.GridRow = 6; label32.Background = new SolidBrush("#404040FF"); var label33 = new Label(); label33.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label33.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label33.GridColumn = 6; label33.GridRow = 7; label33.Background = new SolidBrush("#404040FF"); var label34 = new Label(); label34.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label34.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label34.GridColumn = 6; label34.GridRow = 8; label34.Background = new SolidBrush("#404040FF"); var label35 = new Label(); label35.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label35.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label35.GridColumn = 6; label35.GridRow = 9; label35.Background = new SolidBrush("#404040FF"); var label36 = new Label(); label36.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; label36.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; label36.GridColumn = 6; label36.GridRow = 10; label36.Background = new SolidBrush("#404040FF"); gridfirstColumn_label = new Label(); gridfirstColumn_label.Text = "Valentin"; gridfirstColumn_label.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); gridfirstColumn_label.TextAlign = Myra.Graphics2D.UI.TextAlign.Center; gridfirstColumn_label.TextColor = Color.Black; gridfirstColumn_label.Padding = new Thickness(5, 0); gridfirstColumn_label.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; gridfirstColumn_label.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; gridfirstColumn_label.GridRow = 1; gridfirstColumn_label.Id = "gridfirstColumn_label"; var label37 = new Label(); label37.Text = "Michel"; label37.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label37.TextColor = Color.Black; label37.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label37.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label37.GridRow = 2; var label38 = new Label(); label38.Text = "Michel"; label38.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label38.TextColor = Color.Black; label38.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label38.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label38.GridRow = 3; var label39 = new Label(); label39.Text = "Michel"; label39.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label39.TextColor = Color.Black; label39.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label39.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label39.GridRow = 4; var label40 = new Label(); label40.Text = "Michel"; label40.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label40.TextColor = Color.Black; label40.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label40.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label40.GridRow = 5; var label41 = new Label(); label41.Text = "Michel"; label41.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label41.TextColor = Color.Black; label41.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label41.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label41.GridRow = 6; var label42 = new Label(); label42.Text = "Michel"; label42.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label42.TextColor = Color.Black; label42.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label42.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label42.GridRow = 7; var label43 = new Label(); label43.Text = "Michel"; label43.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label43.TextColor = Color.Black; label43.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label43.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label43.GridRow = 8; var label44 = new Label(); label44.Text = "Michel"; label44.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label44.TextColor = Color.Black; label44.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label44.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label44.GridRow = 9; var label45 = new Label(); label45.Text = "Michel"; label45.Font = MyraEnvironment.DefaultAssetManager.Load <SpriteFont>("fonts/consolas24.fnt"); label45.TextColor = Color.Black; label45.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; label45.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; label45.GridRow = 10; ShowGridLines = true; GridLinesColor = Color.Black; ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Part, }); Background = new SolidBrush("#FFFFFFFF"); Id = "score_grid"; Widgets.Add(gridcontent_label); Widgets.Add(gridfirstcolumn_label); Widgets.Add(gridfirstrowmovablecolumns_label); Widgets.Add(graycell_label); Widgets.Add(label1); Widgets.Add(label2); Widgets.Add(label3); Widgets.Add(label4); Widgets.Add(label5); Widgets.Add(movecolumnleft_button); Widgets.Add(movecolumnright_button); Widgets.Add(label6); Widgets.Add(label7); Widgets.Add(label8); Widgets.Add(label9); Widgets.Add(label10); Widgets.Add(label11); Widgets.Add(label12); Widgets.Add(label13); Widgets.Add(label14); Widgets.Add(label15); Widgets.Add(label16); Widgets.Add(label17); Widgets.Add(label18); Widgets.Add(label19); Widgets.Add(label20); Widgets.Add(label21); Widgets.Add(label22); Widgets.Add(label23); Widgets.Add(label24); Widgets.Add(label25); Widgets.Add(label26); Widgets.Add(label27); Widgets.Add(label28); Widgets.Add(label29); Widgets.Add(label30); Widgets.Add(label31); Widgets.Add(label32); Widgets.Add(label33); Widgets.Add(label34); Widgets.Add(label35); Widgets.Add(label36); Widgets.Add(gridfirstColumn_label); Widgets.Add(label37); Widgets.Add(label38); Widgets.Add(label39); Widgets.Add(label40); Widgets.Add(label41); Widgets.Add(label42); Widgets.Add(label43); Widgets.Add(label44); Widgets.Add(label45); }
private void BuildUI() { _ipLabel = new Label(); _ipLabel.Text = "IP Address:"; _ipLabel.Id = "_ipLabel"; _ipAddressInput = new TextBox(); _ipAddressInput.Text = "localhost"; _ipAddressInput.MinWidth = 150; _ipAddressInput.GridColumn = 1; _ipAddressInput.Id = "_ipAddressInput"; _portLabel = new Label(); _portLabel.Text = "Port:"; _portLabel.GridRow = 1; _portLabel.Id = "_portLabel"; _portInput = new TextBox(); _portInput.Text = "27017"; _portInput.MinWidth = 150; _portInput.GridColumn = 1; _portInput.GridRow = 1; _portInput.Id = "_portInput"; _usernameLabel = new Label(); _usernameLabel.Text = "Username:"******"_usernameLabel"; _usernameInput = new TextBox(); _usernameInput.Text = "username"; _usernameInput.MinWidth = 150; _usernameInput.GridColumn = 1; _usernameInput.GridRow = 2; _usernameInput.Id = "_usernameInput"; _passwordLabel = new Label(); _passwordLabel.Text = "Password:"******"_passwordLabel"; _passwordInput = new TextBox(); _passwordInput.PasswordField = true; _passwordInput.MinWidth = 150; _passwordInput.GridColumn = 1; _passwordInput.GridRow = 3; _passwordInput.Id = "_passwordInput"; _connectButton = new TextButton(); _connectButton.Text = "Connect"; _connectButton.GridRow = 4; _connectButton.Id = "_connectButton"; _statusLabel = new Label(); _statusLabel.Text = "Status:"; _statusLabel.MinWidth = 150; _statusLabel.GridColumn = 1; _statusLabel.GridRow = 4; _statusLabel.Id = "_statusLabel"; _backButton = new TextButton(); _backButton.Text = "Back"; _backButton.GridRow = 5; _backButton.Id = "_backButton"; ShowGridLines = true; ColumnSpacing = 8; RowSpacing = 8; ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; Widgets.Add(_ipLabel); Widgets.Add(_ipAddressInput); Widgets.Add(_portLabel); Widgets.Add(_portInput); Widgets.Add(_usernameLabel); Widgets.Add(_usernameInput); Widgets.Add(_passwordLabel); Widgets.Add(_passwordInput); Widgets.Add(_connectButton); Widgets.Add(_statusLabel); Widgets.Add(_backButton); }
private void BuildUI() { var textBlock1 = new TextBlock(); textBlock1.Text = "Class Name:"; textBlock1.Id = ""; textBlock1.GridPositionY = 1; _textClassName = new TextField(); _textClassName.Text = ""; _textClassName.Id = "_textClassName"; _textClassName.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _textClassName.GridPositionX = 1; _textClassName.GridPositionY = 1; _textClassName.ClipToBounds = true; _textClassName.CanFocus = true; var textBlock2 = new TextBlock(); textBlock2.Text = "Output Path:"; textBlock2.GridPositionY = 2; _textOutputPath = new TextField(); _textOutputPath.Text = ""; _textOutputPath.Id = "_textOutputPath"; _textOutputPath.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _textOutputPath.GridPositionX = 1; _textOutputPath.GridPositionY = 2; _textOutputPath.ClipToBounds = true; _textOutputPath.CanFocus = true; _buttonChangeOutputPath = new Button(); _buttonChangeOutputPath.Text = "Change..."; _buttonChangeOutputPath.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _buttonChangeOutputPath.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _buttonChangeOutputPath.Id = "_buttonChangeOutputPath"; _buttonChangeOutputPath.GridPositionX = 2; _buttonChangeOutputPath.GridPositionY = 2; var textBlock3 = new TextBlock(); textBlock3.Text = "Namespace:"; _textNamespace = new TextField(); _textNamespace.Text = ""; _textNamespace.Id = "_textNamespace"; _textNamespace.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _textNamespace.GridPositionX = 1; _textNamespace.ClipToBounds = true; _textNamespace.CanFocus = true; DrawLinesColor = Color.White; ColumnSpacing = 8; RowSpacing = 8; ColumnsProportions.Add(new Grid.Proportion()); ColumnsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); ColumnsProportions.Add(new Grid.Proportion()); RowsProportions.Add(new Grid.Proportion()); RowsProportions.Add(new Grid.Proportion()); RowsProportions.Add(new Grid.Proportion()); Id = "Root"; WidthHint = 800; HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; Widgets.Add(textBlock1); Widgets.Add(_textClassName); Widgets.Add(textBlock2); Widgets.Add(_textOutputPath); Widgets.Add(_buttonChangeOutputPath); Widgets.Add(textBlock3); Widgets.Add(_textNamespace); }
private void BuildUI() { _textName = new Label(); _textName.Text = "Henry"; _textName.Wrap = true; _textName.Id = "_textName"; var label1 = new Label(); label1.Text = "HP:"; label1.Wrap = true; var label2 = new Label(); label2.Text = "IP:"; label2.Wrap = true; label2.Id = ""; label2.GridRow = 1; _textHP = new Label(); _textHP.Text = "100/100"; _textHP.Wrap = true; _textHP.Id = "_textHP"; _textHP.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; _textHP.GridColumn = 1; _textIP = new Label(); _textIP.Text = "100/100"; _textIP.Wrap = true; _textIP.Id = "_textIP"; _textIP.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; _textIP.GridColumn = 1; _textIP.GridRow = 1; var grid1 = new Grid(); grid1.RowSpacing = 4; grid1.DefaultRowProportion = new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }; grid1.ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); grid1.ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Fill, }); grid1.GridRow = 2; grid1.Widgets.Add(label1); grid1.Widgets.Add(label2); grid1.Widgets.Add(_textHP); grid1.Widgets.Add(_textIP); ShowGridLines = true; RowSpacing = 4; RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Fill, Value = 6, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Left; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Top; Id = "Root"; Width = 200; Height = 300; Widgets.Add(_textName); Widgets.Add(grid1); }
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); }
private void BuildUI() { _openModuleMenuItem = new MenuItem(); _openModuleMenuItem.Text = "&Open Module..."; _openModuleMenuItem.ShortcutText = "Ctrl+O"; _openModuleMenuItem.Id = "_openModuleMenuItem"; _reloadModuleMenuItem = new MenuItem(); _reloadModuleMenuItem.Text = "&Reload Module"; _reloadModuleMenuItem.ShortcutText = "Ctrl+R"; _reloadModuleMenuItem.Id = "_reloadModuleMenuItem"; var menuSeparator1 = new MenuSeparator(); _switchMapMenuItem = new MenuItem(); _switchMapMenuItem.Text = "S&witch Map..."; _switchMapMenuItem.ShortcutText = "Ctrl+W"; _switchMapMenuItem.Id = "_switchMapMenuItem"; _newMapMenuItem = new MenuItem(); _newMapMenuItem.Text = "&New Map..."; _newMapMenuItem.ShortcutText = "Ctrl+N"; _newMapMenuItem.Id = "_newMapMenuItem"; _saveMapMenuItem = new MenuItem(); _saveMapMenuItem.Text = "&Save Map"; _saveMapMenuItem.ShortcutText = "Ctrl+S"; _saveMapMenuItem.Id = "_saveMapMenuItem"; _saveMapAsMenuItem = new MenuItem(); _saveMapAsMenuItem.Text = "Save Map &As"; _saveMapAsMenuItem.Id = "_saveMapAsMenuItem"; _resizeMapMenuItem = new MenuItem(); _resizeMapMenuItem.Text = "Resize &Map"; _resizeMapMenuItem.Id = "_resizeMapMenuItem"; var menuSeparator2 = new MenuSeparator(); _debugOptionsMenuItem = new MenuItem(); _debugOptionsMenuItem.Text = "&UI Debug Options"; _debugOptionsMenuItem.Id = "_debugOptionsMenuItem"; var menuSeparator3 = new MenuSeparator(); _quitMenuItem = new MenuItem(); _quitMenuItem.Text = "&Quit"; _quitMenuItem.ShortcutText = "Ctrl+Q"; _quitMenuItem.Id = "_quitMenuItem"; var menuItem1 = new MenuItem(); menuItem1.Text = "&File"; menuItem1.Items.Add(_openModuleMenuItem); menuItem1.Items.Add(_reloadModuleMenuItem); menuItem1.Items.Add(menuSeparator1); menuItem1.Items.Add(_switchMapMenuItem); menuItem1.Items.Add(_newMapMenuItem); menuItem1.Items.Add(_saveMapMenuItem); menuItem1.Items.Add(_saveMapAsMenuItem); menuItem1.Items.Add(_resizeMapMenuItem); menuItem1.Items.Add(menuSeparator2); menuItem1.Items.Add(_debugOptionsMenuItem); menuItem1.Items.Add(menuSeparator3); menuItem1.Items.Add(_quitMenuItem); _aboutMenuItem = new MenuItem(); _aboutMenuItem.Text = "&About"; _aboutMenuItem.Id = "_aboutMenuItem"; var menuItem2 = new MenuItem(); menuItem2.Text = "&Help"; menuItem2.Items.Add(_aboutMenuItem); _mainMenu = new HorizontalMenu(); _mainMenu.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _mainMenu.Id = "_mainMenu"; _mainMenu.Items.Add(menuItem1); _mainMenu.Items.Add(menuItem2); _textPosition = new Label(); _textPosition.GridRow = 1; _textPosition.Id = "_textPosition"; _leftContainer = new Grid(); _leftContainer.RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Fill, }); _leftContainer.RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); _leftContainer.Id = "_leftContainer"; _leftContainer.Widgets.Add(_textPosition); _mapViewerContainer = new Panel(); _mapViewerContainer.Id = "_mapViewerContainer"; _tilesItem = new ListItem(); _tilesItem.Text = "Tiles"; _tilesItem.Id = "_tilesItem"; _tileObjectsItem = new ListItem(); _tileObjectsItem.Text = "Tile Objects"; _tileObjectsItem.Id = "_tileObjectsItem"; _creaturesItem = new ListItem(); _creaturesItem.Text = "Creatures"; _creaturesItem.Id = "_creaturesItem"; _comboItemTypes = new ComboBox(); _comboItemTypes.Id = "_comboItemTypes"; _comboItemTypes.Items.Add(_tilesItem); _comboItemTypes.Items.Add(_tileObjectsItem); _comboItemTypes.Items.Add(_creaturesItem); var listItem1 = new ListItem(); listItem1.Text = "testTile1"; var listItem2 = new ListItem(); listItem2.Text = "testTile2"; _listBoxItems = new ListBox(); _listBoxItems.GridRow = 1; _listBoxItems.Id = "_listBoxItems"; _listBoxItems.Items.Add(listItem1); _listBoxItems.Items.Add(listItem2); var grid1 = new Grid(); grid1.DefaultRowProportion = new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }; grid1.Widgets.Add(_comboItemTypes); grid1.Widgets.Add(_listBoxItems); var verticalSplitPane1 = new VerticalSplitPane(); verticalSplitPane1.Widgets.Add(_mapViewerContainer); verticalSplitPane1.Widgets.Add(grid1); _topSplitPane = new HorizontalSplitPane(); _topSplitPane.GridRow = 1; _topSplitPane.Id = "_topSplitPane"; _topSplitPane.Widgets.Add(_leftContainer); _topSplitPane.Widgets.Add(verticalSplitPane1); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Auto, }); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.ProportionType.Fill, }); Id = "Root"; Widgets.Add(_mainMenu); Widgets.Add(_topSplitPane); }
private void BuildUI() { _menuFileNew = new MenuItem(); _menuFileNew.Id = "_menuFileNew"; _menuFileNew.Text = "&New"; _menuFileOpen = new MenuItem(); _menuFileOpen.Id = "_menuFileOpen"; _menuFileOpen.Text = "&Open"; _menuFileReload = new MenuItem(); _menuFileReload.Id = "_menuFileReload"; _menuFileReload.Text = "&Reload"; _menuFileSave = new MenuItem(); _menuFileSave.Id = "_menuFileSave"; _menuFileSave.Text = "&Save"; _menuFileSaveAs = new MenuItem(); _menuFileSaveAs.Id = "_menuFileSaveAs"; _menuFileSaveAs.Text = "Save &As..."; _menuFileExportToCS = new MenuItem(); _menuFileExportToCS.Id = "_menuFileExportToCS"; _menuFileExportToCS.Text = "&Export To C#..."; var menuSeparator1 = new MenuSeparator(); _menuFileLoadStylesheet = new MenuItem(); _menuFileLoadStylesheet.Id = "_menuFileLoadStylesheet"; _menuFileLoadStylesheet.Text = "&Load Stylesheet"; _menuFileReloadStylesheet = new MenuItem(); _menuFileReloadStylesheet.Id = "_menuFileReloadStylesheet"; _menuFileReloadStylesheet.Text = "Rel&oad Stylesheet"; _menuFileResetStylesheet = new MenuItem(); _menuFileResetStylesheet.Id = "_menuFileResetStylesheet"; _menuFileResetStylesheet.Text = "Rese&t Stylesheet"; var menuSeparator2 = new MenuSeparator(); _menuFileDebugOptions = new MenuItem(); _menuFileDebugOptions.Id = "_menuFileDebugOptions"; _menuFileDebugOptions.Text = "&UI Debug Options"; var menuSeparator3 = new MenuSeparator(); _menuFileQuit = new MenuItem(); _menuFileQuit.Id = "_menuFileQuit"; _menuFileQuit.Text = "&Quit"; var menuItem1 = new MenuItem(); menuItem1.Id = ""; menuItem1.Text = "&File"; menuItem1.Items.Add(_menuFileNew); menuItem1.Items.Add(_menuFileOpen); menuItem1.Items.Add(_menuFileReload); menuItem1.Items.Add(_menuFileSave); menuItem1.Items.Add(_menuFileSaveAs); menuItem1.Items.Add(_menuFileExportToCS); menuItem1.Items.Add(menuSeparator1); menuItem1.Items.Add(_menuFileLoadStylesheet); menuItem1.Items.Add(_menuFileReloadStylesheet); menuItem1.Items.Add(_menuFileResetStylesheet); menuItem1.Items.Add(menuSeparator2); menuItem1.Items.Add(_menuFileDebugOptions); menuItem1.Items.Add(menuSeparator3); menuItem1.Items.Add(_menuFileQuit); _menuEditFormatSource = new MenuItem(); _menuEditFormatSource.Id = "_menuEditFormatSource"; _menuEditFormatSource.Text = "&Format Source"; var menuItem2 = new MenuItem(); menuItem2.Id = ""; menuItem2.Text = "&Edit"; menuItem2.Items.Add(_menuEditFormatSource); _menuHelpAbout = new MenuItem(); _menuHelpAbout.Id = "_menuHelpAbout"; _menuHelpAbout.Text = "&About"; var menuItem3 = new MenuItem(); menuItem3.Id = ""; menuItem3.Text = "&Help"; menuItem3.Items.Add(_menuHelpAbout); var horizontalMenu1 = new HorizontalMenu(); horizontalMenu1.Id = ""; horizontalMenu1.Items.Add(menuItem1); horizontalMenu1.Items.Add(menuItem2); horizontalMenu1.Items.Add(menuItem3); _projectHolder = new Panel(); _projectHolder.Id = "_projectHolder"; _textSource = new TextField(); _textSource.Text = ""; _textSource.Multiline = true; _textSource.Wrap = true; _textSource.Id = "_textSource"; _textSource.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _textSource.GridRow = 2; var scrollPane1 = new ScrollPane(); scrollPane1.GridRow = 2; scrollPane1.Content = _textSource; _leftSplitPane = new VerticalSplitPane(); _leftSplitPane.Id = "_leftSplitPane"; _leftSplitPane.Widgets.Add(_projectHolder); _leftSplitPane.Widgets.Add(scrollPane1); var horizontalSeparator1 = new HorizontalSeparator(); horizontalSeparator1.GridRow = 1; _textStatus = new TextBlock(); _textStatus.Text = "Reloading..."; _textStatus.Id = "_textStatus"; _textStatus.GridRow = 2; var grid1 = new Grid(); grid1.RowsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid1.RowsProportions.Add(new Grid.Proportion()); grid1.RowsProportions.Add(new Grid.Proportion()); grid1.Widgets.Add(_leftSplitPane); grid1.Widgets.Add(horizontalSeparator1); grid1.Widgets.Add(_textStatus); _propertyGridPane = new ScrollPane(); _propertyGridPane.Content = null; _propertyGridPane.Id = "_propertyGridPane"; var horizontalSeparator2 = new HorizontalSeparator(); horizontalSeparator2.GridRow = 1; _textLocation = new TextBlock(); _textLocation.Text = "Line: 1, Column: 2, Indent: 3"; _textLocation.Id = "_textLocation"; _textLocation.GridRow = 2; var grid2 = new Grid(); grid2.RowsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid2.RowsProportions.Add(new Grid.Proportion()); grid2.RowsProportions.Add(new Grid.Proportion()); grid2.GridColumn = 2; grid2.Widgets.Add(_propertyGridPane); grid2.Widgets.Add(horizontalSeparator2); grid2.Widgets.Add(_textLocation); _topSplitPane = new HorizontalSplitPane(); _topSplitPane.Id = "_topSplitPane"; _topSplitPane.GridRow = 1; _topSplitPane.Widgets.Add(grid1); _topSplitPane.Widgets.Add(grid2); RowsProportions.Add(new Grid.Proportion()); RowsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); Id = "Root"; Widgets.Add(horizontalMenu1); Widgets.Add(_topSplitPane); }
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.Width = 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.Width = 100; _buttonGrid.GridColumn = 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.Width = 100; _buttonNotepad.GridColumn = 2; var grid1 = new Grid(); grid1.GridLinesColor = 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.GridRow = 1; GridLinesColor = 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); }
private void BuildUI() { _menuItemNew = new MenuItem(); _menuItemNew.Id = "_menuItemNew"; _menuItemNew.Text = "&New"; _menuItemOpen = new MenuItem(); _menuItemOpen.Id = "_menuItemOpen"; _menuItemOpen.Text = "&Open"; _menuItemSave = new MenuItem(); _menuItemSave.Id = "_menuItemSave"; _menuItemSave.Text = "&Save"; _menuItemSaveAs = new MenuItem(); _menuItemSaveAs.Id = "_menuItemSaveAs"; _menuItemSaveAs.Text = "Save &As..."; var menuSeparator1 = new MenuSeparator(); _menuItemQuit = new MenuItem(); _menuItemQuit.Id = "_menuItemQuit"; _menuItemQuit.Text = "&Quit"; var menuItem1 = new MenuItem(); menuItem1.Id = ""; menuItem1.Text = "&File"; menuItem1.Items.Add(_menuItemNew); menuItem1.Items.Add(_menuItemOpen); menuItem1.Items.Add(_menuItemSave); menuItem1.Items.Add(_menuItemSaveAs); menuItem1.Items.Add(menuSeparator1); menuItem1.Items.Add(_menuItemQuit); _menuItemCopy = new MenuItem(); _menuItemCopy.Id = "_menuItemCopy"; _menuItemCopy.Text = "&Copy"; _menuItemPaste = new MenuItem(); _menuItemPaste.Id = "_menuItemPaste"; _menuItemPaste.Text = "&Paste"; var menuSeparator2 = new MenuSeparator(); _menuItemUndo = new MenuItem(); _menuItemUndo.Id = "_menuItemUndo"; _menuItemUndo.Text = "&Undo"; _menuItemRedo = new MenuItem(); _menuItemRedo.Id = "_menuItemRedo"; _menuItemRedo.Text = "&Redo"; var menuItem2 = new MenuItem(); menuItem2.Id = ""; menuItem2.Text = "&Edit"; menuItem2.Items.Add(_menuItemCopy); menuItem2.Items.Add(_menuItemPaste); menuItem2.Items.Add(menuSeparator2); menuItem2.Items.Add(_menuItemUndo); menuItem2.Items.Add(_menuItemRedo); _menuItemAbout = new MenuItem(); _menuItemAbout.Id = "_menuItemAbout"; _menuItemAbout.Text = "&About"; var menuItem3 = new MenuItem(); menuItem3.Id = ""; menuItem3.Text = "&Help"; menuItem3.Items.Add(_menuItemAbout); var horizontalMenu1 = new HorizontalMenu(); horizontalMenu1.DrawLinesColor = Color.White; horizontalMenu1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; horizontalMenu1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; horizontalMenu1.Items.Add(menuItem1); horizontalMenu1.Items.Add(menuItem2); horizontalMenu1.Items.Add(menuItem3); var textBlock1 = new TextBlock(); textBlock1.Text = "Button:"; textBlock1.TextColor = Color.White; textBlock1.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock1.Id = ""; _button = new Button(); _button.Text = "Show Window"; _button.TextColor = Color.White; _button.ImageTextSpacing = 8; _button.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _button.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _button.Id = "_button"; _button.PaddingLeft = 8; _button.PaddingRight = 8; _button.GridPositionX = 1; var textBlock2 = new TextBlock(); textBlock2.Text = "Blue Button:"; textBlock2.TextColor = Color.White; textBlock2.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock2.Id = ""; textBlock2.GridPositionY = 1; _blueButton = new Button("blue"); _blueButton.Text = "Show Window"; _blueButton.TextColor = Color.White; _blueButton.ImageTextSpacing = 8; _blueButton.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _blueButton.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _blueButton.Id = "_blueButton"; _blueButton.PaddingLeft = 8; _blueButton.PaddingRight = 8; _blueButton.GridPositionX = 1; _blueButton.GridPositionY = 1; var textBlock3 = new TextBlock(); textBlock3.Text = "Text Button:"; textBlock3.TextColor = Color.White; textBlock3.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock3.Id = ""; textBlock3.GridPositionY = 2; _textButton = new TextButton(); _textButton.Text = "Show Window"; _textButton.TextColor = Color.White; _textButton.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; _textButton.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; _textButton.Id = "_textButton"; _textButton.PaddingLeft = 8; _textButton.PaddingRight = 8; _textButton.GridPositionX = 1; _textButton.GridPositionY = 2; var textBlock4 = new TextBlock(); textBlock4.Text = "Image Button:"; textBlock4.TextColor = Color.White; textBlock4.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock4.Id = ""; textBlock4.GridPositionY = 3; _imageButton = new ImageButton(); _imageButton.ImageVisible = true; _imageButton.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; _imageButton.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center; _imageButton.Id = "_imageButton"; _imageButton.PaddingLeft = 8; _imageButton.PaddingRight = 8; _imageButton.GridPositionX = 1; _imageButton.GridPositionY = 3; var checkBox1 = new CheckBox(); checkBox1.Text = "This is checkbox"; checkBox1.TextColor = Color.White; checkBox1.ImageWidthHint = 10; checkBox1.ImageHeightHint = 10; checkBox1.ContentHorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; checkBox1.ContentVerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; checkBox1.GridPositionY = 4; checkBox1.GridSpanX = 2; var textBlock5 = new TextBlock(); textBlock5.Text = "Horizontal Slider:"; textBlock5.TextColor = Color.White; textBlock5.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock5.Id = ""; textBlock5.GridPositionY = 5; var horizontalSlider1 = new HorizontalSlider(); horizontalSlider1.Maximum = 100; horizontalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; horizontalSlider1.GridPositionX = 1; horizontalSlider1.GridPositionY = 5; var textBlock6 = new TextBlock(); textBlock6.Text = "Combo Box:"; textBlock6.TextColor = Color.White; textBlock6.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock6.GridPositionY = 6; var listItem1 = new ListItem(); listItem1.Id = ""; listItem1.Text = "Red"; listItem1.Color = Color.Red; var listItem2 = new ListItem(); listItem2.Text = "Green"; listItem2.Color = Color.Lime; var listItem3 = new ListItem(); listItem3.Text = "Blue"; listItem3.Color = new Color { B = 255, G = 128, A = 255, PackedValue = 4294934528, }; var comboBox1 = new ComboBox(); comboBox1.WidthHint = 200; comboBox1.GridPositionX = 1; comboBox1.GridPositionY = 6; comboBox1.Items.Add(listItem1); comboBox1.Items.Add(listItem2); comboBox1.Items.Add(listItem3); var textBlock7 = new TextBlock(); textBlock7.Text = "Text Field:"; textBlock7.TextColor = Color.White; textBlock7.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock7.GridPositionY = 7; var textField1 = new TextField(); textField1.Text = ""; textField1.TextColor = Color.White; textField1.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textField1.MessageTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textField1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; textField1.GridPositionX = 1; textField1.GridPositionY = 7; textField1.CanFocus = true; var textBlock8 = new TextBlock(); textBlock8.Text = "Spin Button:"; textBlock8.TextColor = Color.White; textBlock8.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock8.GridPositionY = 8; var spinButton1 = new SpinButton(); spinButton1.Value = 0; spinButton1.DrawLinesColor = Color.White; spinButton1.WidthHint = 100; spinButton1.GridPositionX = 1; spinButton1.GridPositionY = 8; var textBlock9 = new TextBlock(); textBlock9.Text = "List Box:"; textBlock9.TextColor = Color.White; textBlock9.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock9.GridPositionY = 9; var listItem4 = new ListItem(); listItem4.Text = "Red"; listItem4.Color = Color.Red; var listItem5 = new ListItem(); listItem5.Text = "Green"; listItem5.Color = Color.Lime; var listItem6 = new ListItem(); listItem6.Text = "Blue"; listItem6.Color = Color.Blue; var listBox1 = new ListBox(); listBox1.DrawLinesColor = Color.White; listBox1.WidthHint = 200; listBox1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; listBox1.GridPositionX = 1; listBox1.GridPositionY = 9; listBox1.Items.Add(listItem4); listBox1.Items.Add(listItem5); listBox1.Items.Add(listItem6); var textBlock10 = new TextBlock(); textBlock10.Text = "Vertical Menu:"; textBlock10.TextColor = Color.White; textBlock10.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock10.GridPositionY = 10; var menuItem4 = new MenuItem(); menuItem4.Id = ""; menuItem4.Text = "Start New Game"; var menuItem5 = new MenuItem(); menuItem5.Id = ""; menuItem5.Text = "Options"; var menuItem6 = new MenuItem(); menuItem6.Id = ""; menuItem6.Text = "Quit"; var verticalMenu1 = new VerticalMenu(); verticalMenu1.DrawLinesColor = Color.White; verticalMenu1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; verticalMenu1.GridPositionX = 1; verticalMenu1.GridPositionY = 10; verticalMenu1.Items.Add(menuItem4); verticalMenu1.Items.Add(menuItem5); verticalMenu1.Items.Add(menuItem6); var textBlock11 = new TextBlock(); textBlock11.Text = "Tree"; textBlock11.TextColor = Color.White; textBlock11.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; textBlock11.GridPositionY = 11; _gridRight = new Grid(); _gridRight.DrawLinesColor = Color.White; _gridRight.ColumnSpacing = 8; _gridRight.RowSpacing = 8; _gridRight.ColumnsProportions.Add(new Proportion()); _gridRight.ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.RowsProportions.Add(new Proportion()); _gridRight.Id = "_gridRight"; _gridRight.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _gridRight.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _gridRight.Widgets.Add(textBlock1); _gridRight.Widgets.Add(_button); _gridRight.Widgets.Add(textBlock2); _gridRight.Widgets.Add(_blueButton); _gridRight.Widgets.Add(textBlock3); _gridRight.Widgets.Add(_textButton); _gridRight.Widgets.Add(textBlock4); _gridRight.Widgets.Add(_imageButton); _gridRight.Widgets.Add(checkBox1); _gridRight.Widgets.Add(textBlock5); _gridRight.Widgets.Add(horizontalSlider1); _gridRight.Widgets.Add(textBlock6); _gridRight.Widgets.Add(comboBox1); _gridRight.Widgets.Add(textBlock7); _gridRight.Widgets.Add(textField1); _gridRight.Widgets.Add(textBlock8); _gridRight.Widgets.Add(spinButton1); _gridRight.Widgets.Add(textBlock9); _gridRight.Widgets.Add(listBox1); _gridRight.Widgets.Add(textBlock10); _gridRight.Widgets.Add(verticalMenu1); _gridRight.Widgets.Add(textBlock11); var scrollPane1 = new ScrollPane(); scrollPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; scrollPane1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; scrollPane1.ClipToBounds = true; scrollPane1.CanFocus = true; scrollPane1.Child = _gridRight; var textBlock12 = new TextBlock(); textBlock12.Text = "Vertical Slider:"; textBlock12.TextColor = Color.White; textBlock12.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; var verticalSlider1 = new VerticalSlider(); verticalSlider1.Maximum = 100; verticalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; verticalSlider1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; verticalSlider1.GridPositionY = 1; var grid1 = new Grid(); grid1.DrawLinesColor = Color.White; grid1.RowSpacing = 8; grid1.ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid1.RowsProportions.Add(new Proportion()); grid1.RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; grid1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; grid1.Widgets.Add(textBlock12); grid1.Widgets.Add(verticalSlider1); var textBlock13 = new TextBlock(); textBlock13.Text = "Progress Bars:"; textBlock13.TextColor = Color.White; textBlock13.DisabledTextColor = new Color { B = 170, G = 170, R = 170, A = 255, PackedValue = 4289374890, }; _horizontalProgressBar = new HorizontalProgressBar(); _horizontalProgressBar.Maximum = 100; _horizontalProgressBar.DrawLinesColor = Color.White; _horizontalProgressBar.Id = "_horizontalProgressBar"; _horizontalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; _horizontalProgressBar.GridPositionY = 1; _verticalProgressBar = new VerticalProgressBar(); _verticalProgressBar.Maximum = 100; _verticalProgressBar.DrawLinesColor = Color.White; _verticalProgressBar.Id = "_verticalProgressBar"; _verticalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; _verticalProgressBar.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; _verticalProgressBar.GridPositionY = 2; var grid2 = new Grid(); grid2.DrawLinesColor = Color.White; grid2.RowSpacing = 8; grid2.ColumnsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid2.RowsProportions.Add(new Proportion()); grid2.RowsProportions.Add(new Proportion()); grid2.RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid2.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; grid2.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; grid2.GridPositionY = 2; grid2.Widgets.Add(textBlock13); grid2.Widgets.Add(_horizontalProgressBar); grid2.Widgets.Add(_verticalProgressBar); var verticalSplitPane1 = new VerticalSplitPane(); verticalSplitPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; verticalSplitPane1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; verticalSplitPane1.GridPositionX = 2; verticalSplitPane1.Widgets.Add(grid1); verticalSplitPane1.Widgets.Add(grid2); var horizontalSplitPane1 = new HorizontalSplitPane(); horizontalSplitPane1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; horizontalSplitPane1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; horizontalSplitPane1.GridPositionY = 1; horizontalSplitPane1.Widgets.Add(scrollPane1); horizontalSplitPane1.Widgets.Add(verticalSplitPane1); DrawLinesColor = Color.White; RowSpacing = 8; RowsProportions.Add(new Proportion()); RowsProportions.Add(new Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); Id = "Root"; HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Stretch; VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; Widgets.Add(horizontalMenu1); Widgets.Add(horizontalSplitPane1); }
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 Button(); _buttonSaveFile.Text = "Save File"; _buttonSaveFile.Id = "_buttonSaveFile"; _buttonSaveFile.PaddingLeft = 8; _buttonSaveFile.PaddingRight = 8; _buttonSaveFile.GridColumn = 1; _textSaveFile = new TextField(); _textSaveFile.Text = ""; _textSaveFile.Id = "_textSaveFile"; _textSaveFile.GridColumn = 2; var textBlock2 = new TextBlock(); textBlock2.Text = "Another Button:"; textBlock2.Id = ""; textBlock2.GridRow = 1; _buttonOpenFile = new Button(); _buttonOpenFile.Text = "Open File"; _buttonOpenFile.Id = "_buttonOpenFile"; _buttonOpenFile.PaddingLeft = 8; _buttonOpenFile.PaddingRight = 8; _buttonOpenFile.GridColumn = 1; _buttonOpenFile.GridRow = 1; _textOpenFile = new TextField(); _textOpenFile.Text = ""; _textOpenFile.Id = "_textOpenFile"; _textOpenFile.GridColumn = 2; _textOpenFile.GridRow = 1; var textBlock3 = new TextBlock(); textBlock3.Text = "Blue Button:"; textBlock3.Id = ""; textBlock3.GridRow = 2; _buttonChooseFolder = new Button("blue"); _buttonChooseFolder.Text = "Choose Folder"; _buttonChooseFolder.Id = "_buttonChooseFolder"; _buttonChooseFolder.PaddingLeft = 8; _buttonChooseFolder.PaddingRight = 8; _buttonChooseFolder.GridColumn = 1; _buttonChooseFolder.GridRow = 2; _textChooseFolder = new TextField(); _textChooseFolder.Text = ""; _textChooseFolder.Id = "_textChooseFolder"; _textChooseFolder.GridColumn = 2; _textChooseFolder.GridRow = 2; _textButtonLabel = new TextBlock(); _textButtonLabel.Text = "Text Button:"; _textButtonLabel.Id = "_textButtonLabel"; _textButtonLabel.GridRow = 3; _buttonChooseColor = new TextButton(); _buttonChooseColor.Text = "Choose Color"; _buttonChooseColor.Id = "_buttonChooseColor"; _buttonChooseColor.PaddingLeft = 8; _buttonChooseColor.PaddingRight = 8; _buttonChooseColor.GridColumn = 1; _buttonChooseColor.GridRow = 3; var textBlock4 = new TextBlock(); textBlock4.Text = "Image Button:"; textBlock4.Id = ""; textBlock4.GridRow = 4; _imageButton = new ImageButton(); _imageButton.Id = "_imageButton"; _imageButton.PaddingLeft = 8; _imageButton.PaddingRight = 8; _imageButton.GridColumn = 1; _imageButton.GridRow = 4; var checkBox1 = new CheckBox(); checkBox1.Text = "This is checkbox"; checkBox1.ImageWidth = 10; checkBox1.ImageHeight = 10; checkBox1.GridRow = 5; checkBox1.GridColumnSpan = 2; var textBlock5 = new TextBlock(); textBlock5.Text = "Horizontal Slider:"; textBlock5.Id = ""; textBlock5.GridRow = 6; var horizontalSlider1 = new HorizontalSlider(); horizontalSlider1.GridColumn = 1; horizontalSlider1.GridRow = 6; horizontalSlider1.GridColumnSpan = 2; var textBlock6 = new TextBlock(); textBlock6.Text = "Combo Box:"; textBlock6.GridRow = 7; var listItem1 = new ListItem(); listItem1.Id = ""; listItem1.Text = "Red"; listItem1.Color = Color.Red; var listItem2 = new ListItem(); listItem2.Id = null; listItem2.Text = "Green"; listItem2.Color = Color.Lime; var listItem3 = new ListItem(); listItem3.Id = null; listItem3.Text = "Blue"; listItem3.Color = new Color { B = 255, G = 128, R = 0, A = 255, }; var comboBox1 = new ComboBox(); comboBox1.SelectedIndex = 1; comboBox1.Width = 200; comboBox1.GridColumn = 1; comboBox1.GridRow = 7; comboBox1.GridColumnSpan = 2; comboBox1.Items.Add(listItem1); comboBox1.Items.Add(listItem2); comboBox1.Items.Add(listItem3); var textBlock7 = new TextBlock(); textBlock7.Text = "Text Field:"; textBlock7.GridRow = 8; var textField1 = new TextField(); textField1.Text = ""; textField1.GridColumn = 1; textField1.GridRow = 8; textField1.GridColumnSpan = 2; var textBlock8 = new TextBlock(); textBlock8.Text = "Spin Button:"; textBlock8.GridRow = 9; var spinButton1 = new SpinButton(); spinButton1.Width = 100; spinButton1.GridColumn = 1; spinButton1.GridRow = 9; var textBlock9 = new TextBlock(); textBlock9.Text = "List Box:"; textBlock9.GridRow = 10; var listItem4 = new ListItem(); listItem4.Id = null; listItem4.Text = "Red"; listItem4.Color = Color.Red; var listItem5 = new ListItem(); listItem5.Id = null; listItem5.Text = "Green"; listItem5.Color = Color.Lime; var listItem6 = new ListItem(); listItem6.Id = null; listItem6.Text = "Blue"; listItem6.Color = Color.Blue; var listBox1 = new ListBox(); listBox1.Width = 200; listBox1.GridColumn = 1; listBox1.GridRow = 10; listBox1.GridColumnSpan = 2; listBox1.Items.Add(listItem4); listBox1.Items.Add(listItem5); listBox1.Items.Add(listItem6); var textBlock10 = new TextBlock(); textBlock10.Text = "Vertical Menu:"; textBlock10.GridRow = 11; var menuItem4 = new MenuItem(); menuItem4.Id = ""; menuItem4.Text = "Start New Game"; var menuItem5 = new MenuItem(); menuItem5.Id = ""; menuItem5.Text = "Options"; var menuItem6 = new MenuItem(); menuItem6.Id = ""; menuItem6.Text = "Quit"; var verticalMenu1 = new VerticalMenu(); verticalMenu1.GridColumn = 1; verticalMenu1.GridRow = 11; verticalMenu1.Items.Add(menuItem4); verticalMenu1.Items.Add(menuItem5); verticalMenu1.Items.Add(menuItem6); var textBlock11 = new TextBlock(); textBlock11.Text = "Tree"; textBlock11.GridRow = 12; _gridRight = new Grid(); _gridRight.ColumnSpacing = 8; _gridRight.RowSpacing = 8; _gridRight.ColumnsProportions.Add(new Grid.Proportion()); _gridRight.ColumnsProportions.Add(new Grid.Proportion()); _gridRight.ColumnsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.RowsProportions.Add(new Grid.Proportion()); _gridRight.Id = "_gridRight"; _gridRight.Widgets.Add(textBlock1); _gridRight.Widgets.Add(_buttonSaveFile); _gridRight.Widgets.Add(_textSaveFile); _gridRight.Widgets.Add(textBlock2); _gridRight.Widgets.Add(_buttonOpenFile); _gridRight.Widgets.Add(_textOpenFile); _gridRight.Widgets.Add(textBlock3); _gridRight.Widgets.Add(_buttonChooseFolder); _gridRight.Widgets.Add(_textChooseFolder); _gridRight.Widgets.Add(_textButtonLabel); _gridRight.Widgets.Add(_buttonChooseColor); _gridRight.Widgets.Add(textBlock4); _gridRight.Widgets.Add(_imageButton); _gridRight.Widgets.Add(checkBox1); _gridRight.Widgets.Add(textBlock5); _gridRight.Widgets.Add(horizontalSlider1); _gridRight.Widgets.Add(textBlock6); _gridRight.Widgets.Add(comboBox1); _gridRight.Widgets.Add(textBlock7); _gridRight.Widgets.Add(textField1); _gridRight.Widgets.Add(textBlock8); _gridRight.Widgets.Add(spinButton1); _gridRight.Widgets.Add(textBlock9); _gridRight.Widgets.Add(listBox1); _gridRight.Widgets.Add(textBlock10); _gridRight.Widgets.Add(verticalMenu1); _gridRight.Widgets.Add(textBlock11); var scrollPane1 = new ScrollPane(); scrollPane1.Child = _gridRight; var textBlock12 = new TextBlock(); textBlock12.Text = "Vertical Slider:"; var verticalSlider1 = new VerticalSlider(); verticalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; verticalSlider1.GridRow = 1; var grid1 = new Grid(); grid1.RowSpacing = 8; grid1.ColumnsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid1.RowsProportions.Add(new Grid.Proportion()); grid1.RowsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid1.Widgets.Add(textBlock12); grid1.Widgets.Add(verticalSlider1); var textBlock13 = new TextBlock(); textBlock13.Text = "Progress Bars:"; _horizontalProgressBar = new HorizontalProgressBar(); _horizontalProgressBar.Id = "_horizontalProgressBar"; _horizontalProgressBar.GridRow = 1; _verticalProgressBar = new VerticalProgressBar(); _verticalProgressBar.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center; _verticalProgressBar.Id = "_verticalProgressBar"; _verticalProgressBar.GridRow = 2; var grid2 = new Grid(); grid2.RowSpacing = 8; grid2.ColumnsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid2.RowsProportions.Add(new Grid.Proportion()); grid2.RowsProportions.Add(new Grid.Proportion()); grid2.RowsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); grid2.GridRow = 2; grid2.Widgets.Add(textBlock13); grid2.Widgets.Add(_horizontalProgressBar); grid2.Widgets.Add(_verticalProgressBar); var verticalSplitPane1 = new VerticalSplitPane(); verticalSplitPane1.GridColumn = 2; verticalSplitPane1.Widgets.Add(grid1); verticalSplitPane1.Widgets.Add(grid2); var horizontalSplitPane1 = new HorizontalSplitPane(); horizontalSplitPane1.GridRow = 1; horizontalSplitPane1.Widgets.Add(scrollPane1); horizontalSplitPane1.Widgets.Add(verticalSplitPane1); RowSpacing = 8; RowsProportions.Add(new Grid.Proportion()); RowsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); Id = "Root"; Widgets.Add(horizontalMenu1); Widgets.Add(horizontalSplitPane1); }
private void BuildUI() { menuItemNew = new MenuItem(); menuItemNew.Id = "menuItemNew"; menuItemNew.Text = "New"; menuItemOpen = new MenuItem(); menuItemOpen.Id = "menuItemOpen"; menuItemOpen.Text = "Open..."; menuItemSave = new MenuItem(); menuItemSave.Id = "menuItemSave"; menuItemSave.Text = "Save"; menuItemSaveAs = new MenuItem(); menuItemSaveAs.Id = "menuItemSaveAs"; menuItemSaveAs.Text = "Save As..."; var menuSeparator1 = new MenuSeparator(); menuItemDebugOptions = new MenuItem(); menuItemDebugOptions.Id = "menuItemDebugOptions"; menuItemDebugOptions.Text = "Debug Options"; var menuSeparator2 = new MenuSeparator(); menuItemQuit = new MenuItem(); menuItemQuit.Id = "menuItemQuit"; menuItemQuit.Text = "Quit"; menuItemFile = new MenuItem(); menuItemFile.Id = "menuItemFile"; menuItemFile.Text = "File"; menuItemFile.Items.Add(menuItemNew); menuItemFile.Items.Add(menuItemOpen); menuItemFile.Items.Add(menuItemSave); menuItemFile.Items.Add(menuItemSaveAs); menuItemFile.Items.Add(menuSeparator1); menuItemFile.Items.Add(menuItemDebugOptions); menuItemFile.Items.Add(menuSeparator2); menuItemFile.Items.Add(menuItemQuit); menuItemAbout = new MenuItem(); menuItemAbout.Id = "menuItemAbout"; menuItemAbout.Text = "About"; menuItemHelp = new MenuItem(); menuItemHelp.Id = "menuItemHelp"; menuItemHelp.Text = "Help"; menuItemHelp.Items.Add(menuItemAbout); mainMenu = new HorizontalMenu(); mainMenu.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; mainMenu.Id = "mainMenu"; mainMenu.Items.Add(menuItemFile); mainMenu.Items.Add(menuItemHelp); var horizontalSeparator1 = new HorizontalSeparator(); horizontalSeparator1.GridRow = 1; textArea = new TextField(); textArea.Text = ""; textArea.Multiline = true; textArea.Wrap = true; textArea.Id = "textArea"; textArea.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Stretch; var scrollPane1 = new ScrollPane(); scrollPane1.GridRow = 2; scrollPane1.Content = textArea; RowsProportions.Add(new Grid.Proportion()); RowsProportions.Add(new Grid.Proportion()); RowsProportions.Add(new Grid.Proportion { Type = Myra.Graphics2D.UI.Grid.ProportionType.Fill, }); Id = "Root"; Widgets.Add(mainMenu); Widgets.Add(horizontalSeparator1); Widgets.Add(scrollPane1); }