Skip to content

Commit

Permalink
Fixes #427
Browse files Browse the repository at this point in the history
  • Loading branch information
rds1983 committed Oct 31, 2023
1 parent 6b3f362 commit 775d8ac
Show file tree
Hide file tree
Showing 17 changed files with 448 additions and 163 deletions.
86 changes: 44 additions & 42 deletions samples/Myra.Samples.AllWidgets/AllWidgets.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by MyraPad at 10/27/2023 8:14:34 AM */
/* Generated by MyraPad at 10/31/2023 1:26:35 PM */
using Myra;
using Myra.Graphics2D;
using Myra.Graphics2D.TextureAtlases;
Expand Down Expand Up @@ -183,25 +183,27 @@ private void BuildUI()
Grid.SetRow(_imageButton, 4);
_imageButton.Content = image1;

var checkBox1 = new CheckBox();
checkBox1.Text = "This is checkbox";
checkBox1.ImageWidth = 10;
checkBox1.ImageHeight = 10;
Grid.SetRow(checkBox1, 5);
Grid.SetColumnSpan(checkBox1, 2);

var label6 = new Label();
label6.Text = "Horizontal Slider:";
Grid.SetRow(label6, 6);
label6.Text = "This is checkbox";

var checkButton1 = new CheckButton();
checkButton1.CheckContentSpacing = 4;
Grid.SetRow(checkButton1, 5);
Grid.SetColumnSpan(checkButton1, 2);
checkButton1.Content = label6;

var label7 = new Label();
label7.Text = "Horizontal Slider:";
Grid.SetRow(label7, 6);

var horizontalSlider1 = new HorizontalSlider();
Grid.SetColumn(horizontalSlider1, 1);
Grid.SetRow(horizontalSlider1, 6);
Grid.SetColumnSpan(horizontalSlider1, 2);

var label7 = new Label();
label7.Text = "Combo Box:";
Grid.SetRow(label7, 7);
var label8 = new Label();
label8.Text = "Combo Box:";
Grid.SetRow(label8, 7);

var listItem1 = new ListItem();
listItem1.Text = "Red";
Expand All @@ -224,28 +226,28 @@ private void BuildUI()
comboBox1.Items.Add(listItem2);
comboBox1.Items.Add(listItem3);

var label8 = new Label();
label8.Text = "Text Field:";
Grid.SetRow(label8, 8);
var label9 = new Label();
label9.Text = "Text Field:";
Grid.SetRow(label9, 8);

var textBox1 = new TextBox();
Grid.SetColumn(textBox1, 1);
Grid.SetRow(textBox1, 8);
Grid.SetColumnSpan(textBox1, 2);

var label9 = new Label();
label9.Text = "Spin Button:";
Grid.SetRow(label9, 9);
var label10 = new Label();
label10.Text = "Spin Button:";
Grid.SetRow(label10, 9);

var spinButton1 = new SpinButton();
spinButton1.Value = 1;
spinButton1.Width = 100;
Grid.SetColumn(spinButton1, 1);
Grid.SetRow(spinButton1, 9);

var label10 = new Label();
label10.Text = "List Box:";
Grid.SetRow(label10, 10);
var label11 = new Label();
label11.Text = "List Box:";
Grid.SetRow(label11, 10);

var listItem4 = new ListItem();
listItem4.Text = "Red";
Expand All @@ -268,9 +270,9 @@ private void BuildUI()
listBox1.Items.Add(listItem5);
listBox1.Items.Add(listItem6);

var label11 = new Label();
label11.Text = "Vertical Menu:";
Grid.SetRow(label11, 11);
var label12 = new Label();
label12.Text = "Vertical Menu:";
Grid.SetRow(label12, 11);

var menuItem1 = new MenuItem();
menuItem1.Text = "Start New Game";
Expand All @@ -288,9 +290,9 @@ private void BuildUI()
verticalMenu1.Items.Add(menuItem2);
verticalMenu1.Items.Add(menuItem3);

var label12 = new Label();
label12.Text = "Tree";
Grid.SetRow(label12, 12);
var label13 = new Label();
label13.Text = "Tree";
Grid.SetRow(label13, 12);

_gridRight = new Grid();
_gridRight.ColumnSpacing = 8;
Expand Down Expand Up @@ -325,27 +327,27 @@ private void BuildUI()
_gridRight.Widgets.Add(_buttonChooseColor);
_gridRight.Widgets.Add(label5);
_gridRight.Widgets.Add(_imageButton);
_gridRight.Widgets.Add(checkBox1);
_gridRight.Widgets.Add(label6);
_gridRight.Widgets.Add(horizontalSlider1);
_gridRight.Widgets.Add(checkButton1);
_gridRight.Widgets.Add(label7);
_gridRight.Widgets.Add(comboBox1);
_gridRight.Widgets.Add(horizontalSlider1);
_gridRight.Widgets.Add(label8);
_gridRight.Widgets.Add(textBox1);
_gridRight.Widgets.Add(comboBox1);
_gridRight.Widgets.Add(label9);
_gridRight.Widgets.Add(spinButton1);
_gridRight.Widgets.Add(textBox1);
_gridRight.Widgets.Add(label10);
_gridRight.Widgets.Add(listBox1);
_gridRight.Widgets.Add(spinButton1);
_gridRight.Widgets.Add(label11);
_gridRight.Widgets.Add(verticalMenu1);
_gridRight.Widgets.Add(listBox1);
_gridRight.Widgets.Add(label12);
_gridRight.Widgets.Add(verticalMenu1);
_gridRight.Widgets.Add(label13);

var scrollViewer1 = new ScrollViewer();
scrollViewer1.ShowHorizontalScrollBar = false;
scrollViewer1.Content = _gridRight;

var label13 = new Label();
label13.Text = "Vertical Slider:";
var label14 = new Label();
label14.Text = "Vertical Slider:";

var verticalSlider1 = new VerticalSlider();
verticalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
Expand All @@ -365,11 +367,11 @@ private void BuildUI()
{
Type = Myra.Graphics2D.UI.ProportionType.Fill,
});
grid1.Widgets.Add(label13);
grid1.Widgets.Add(label14);
grid1.Widgets.Add(verticalSlider1);

var label14 = new Label();
label14.Text = "Progress Bars:";
var label15 = new Label();
label15.Text = "Progress Bars:";

_horizontalProgressBar = new HorizontalProgressBar();
_horizontalProgressBar.Id = "_horizontalProgressBar";
Expand Down Expand Up @@ -398,7 +400,7 @@ private void BuildUI()
{
Type = Myra.Graphics2D.UI.ProportionType.Fill,
});
grid2.Widgets.Add(label14);
grid2.Widgets.Add(label15);
grid2.Widgets.Add(_horizontalProgressBar);
grid2.Widgets.Add(_verticalProgressBar);

Expand Down
4 changes: 3 additions & 1 deletion samples/Myra.Samples.AllWidgets/allControls.xmmp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
<Button Padding="8, 0" Id="_imageButton" Grid.Column="1" Grid.Row="4">
<Image />
</Button>
<CheckBox Text="This is checkbox" ImageWidth="10" ImageHeight="10" Grid.Row="5" Grid.ColumnSpan="2" />
<CheckButton CheckContentSpacing="4" Grid.Row="5" Grid.ColumnSpan="2">
<Label Text="This is checkbox" />
</CheckButton>
<Label Text="Horizontal Slider:" Grid.Row="6" />
<HorizontalSlider Grid.Column="1" Grid.Row="6" Grid.ColumnSpan="2" />
<Label Text="Combo Box:" Grid.Row="7" />
Expand Down
69 changes: 35 additions & 34 deletions samples/Myra.Samples.CustomUIStylesheet/AllWidgets.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by MyraPad at 10/26/2023 10:42:08 AM */
/* Generated by MyraPad at 10/31/2023 1:24:24 PM */
using Myra;
using Myra.Graphics2D;
using Myra.Graphics2D.TextureAtlases;
Expand Down Expand Up @@ -60,24 +60,25 @@ private void BuildUI()
Grid.SetRow(_imageButton, 2);
_imageButton.Content = image1;

var checkBox1 = new CheckBox();
checkBox1.Text = "This is checkbox";
checkBox1.ImageWidth = 10;
checkBox1.ImageHeight = 10;
Grid.SetRow(checkBox1, 3);
Grid.SetColumnSpan(checkBox1, 2);

var label4 = new Label();
label4.Text = "Horizontal Slider:";
Grid.SetRow(label4, 4);
label4.Text = "This is checkbox";

var checkButton1 = new CheckButton();
Grid.SetRow(checkButton1, 3);
Grid.SetColumnSpan(checkButton1, 2);
checkButton1.Content = label4;

var label5 = new Label();
label5.Text = "Horizontal Slider:";
Grid.SetRow(label5, 4);

var horizontalSlider1 = new HorizontalSlider();
Grid.SetColumn(horizontalSlider1, 1);
Grid.SetRow(horizontalSlider1, 4);

var label5 = new Label();
label5.Text = "Combo Box:";
Grid.SetRow(label5, 5);
var label6 = new Label();
label6.Text = "Combo Box:";
Grid.SetRow(label6, 5);

var listItem1 = new ListItem();
listItem1.Text = "Red";
Expand All @@ -99,17 +100,17 @@ private void BuildUI()
comboBox1.Items.Add(listItem2);
comboBox1.Items.Add(listItem3);

var label6 = new Label();
label6.Text = "Text Field:";
Grid.SetRow(label6, 6);
var label7 = new Label();
label7.Text = "Text Field:";
Grid.SetRow(label7, 6);

var textBox1 = new TextBox();
Grid.SetColumn(textBox1, 1);
Grid.SetRow(textBox1, 6);

var label7 = new Label();
label7.Text = "List Box:";
Grid.SetRow(label7, 7);
var label8 = new Label();
label8.Text = "List Box:";
Grid.SetRow(label8, 7);

var listItem4 = new ListItem();
listItem4.Text = "Red";
Expand All @@ -131,9 +132,9 @@ private void BuildUI()
listBox1.Items.Add(listItem5);
listBox1.Items.Add(listItem6);

var label8 = new Label();
label8.Text = "Tree";
Grid.SetRow(label8, 8);
var label9 = new Label();
label9.Text = "Tree";
Grid.SetRow(label9, 8);

_gridRight = new Grid();
_gridRight.ColumnSpacing = 8;
Expand All @@ -157,23 +158,23 @@ private void BuildUI()
_gridRight.Widgets.Add(_textButton);
_gridRight.Widgets.Add(label3);
_gridRight.Widgets.Add(_imageButton);
_gridRight.Widgets.Add(checkBox1);
_gridRight.Widgets.Add(label4);
_gridRight.Widgets.Add(horizontalSlider1);
_gridRight.Widgets.Add(checkButton1);
_gridRight.Widgets.Add(label5);
_gridRight.Widgets.Add(comboBox1);
_gridRight.Widgets.Add(horizontalSlider1);
_gridRight.Widgets.Add(label6);
_gridRight.Widgets.Add(textBox1);
_gridRight.Widgets.Add(comboBox1);
_gridRight.Widgets.Add(label7);
_gridRight.Widgets.Add(listBox1);
_gridRight.Widgets.Add(textBox1);
_gridRight.Widgets.Add(label8);
_gridRight.Widgets.Add(listBox1);
_gridRight.Widgets.Add(label9);

var scrollViewer1 = new ScrollViewer();
scrollViewer1.ShowHorizontalScrollBar = false;
scrollViewer1.Content = _gridRight;

var label9 = new Label();
label9.Text = "Vertical Slider:";
var label10 = new Label();
label10.Text = "Vertical Slider:";

var verticalSlider1 = new VerticalSlider();
verticalSlider1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
Expand All @@ -193,11 +194,11 @@ private void BuildUI()
{
Type = Myra.Graphics2D.UI.ProportionType.Fill,
});
grid1.Widgets.Add(label9);
grid1.Widgets.Add(label10);
grid1.Widgets.Add(verticalSlider1);

var label10 = new Label();
label10.Text = "Progress Bars:";
var label11 = new Label();
label11.Text = "Progress Bars:";

_horizontalProgressBar = new HorizontalProgressBar();
_horizontalProgressBar.Id = "_horizontalProgressBar";
Expand Down Expand Up @@ -226,7 +227,7 @@ private void BuildUI()
{
Type = Myra.Graphics2D.UI.ProportionType.Fill,
});
grid2.Widgets.Add(label10);
grid2.Widgets.Add(label11);
grid2.Widgets.Add(_horizontalProgressBar);
grid2.Widgets.Add(_verticalProgressBar);

Expand Down
4 changes: 3 additions & 1 deletion samples/Myra.Samples.CustomUIStylesheet/allControls.xmmp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<Button Id="_imageButton" Grid.Column="1" Grid.Row="2">
<Image />
</Button>
<CheckBox Text="This is checkbox" ImageWidth="10" ImageHeight="10" Grid.Row="3" Grid.ColumnSpan="2" />
<CheckButton Grid.Row="3" Grid.ColumnSpan="2">
<Label Text="This is checkbox" />
</CheckButton>
<Label Text="Horizontal Slider:" Grid.Row="4" />
<HorizontalSlider Grid.Column="1" Grid.Row="4" />
<Label Text="Combo Box:" Grid.Row="5" />
Expand Down
15 changes: 11 additions & 4 deletions samples/Myra.Samples.GridContainer/GridGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,15 @@ protected override void LoadContent()
grid.Widgets.Add(button);

// Button
var button2 = new TextButton
var button2 = new Button
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Text = "This is 2 rows button"
Content = new Label
{
Text = "This is 2 rows button"
}

};
Grid.SetColumn(button2, 2);
Grid.SetRow(button2, 2);
Expand Down Expand Up @@ -189,9 +193,12 @@ protected override void LoadContent()

grid.Widgets.Add(textBlock);

var checkBox = new CheckBox
var checkBox = new CheckButton
{
Text = "This is a checkbox",
Content = new Label
{
Text = "This is a checkbox"
}
};
Grid.SetColumn(checkBox, 3);
Grid.SetRow(checkBox, 3);
Expand Down
Loading

0 comments on commit 775d8ac

Please sign in to comment.