diff options
author | nosami <jasonimison@gmail.com> | 2019-10-30 01:50:36 +0300 |
---|---|---|
committer | nosami <jasonimison@gmail.com> | 2019-10-31 14:38:39 +0300 |
commit | a1a4e117ed2a0b70420a4b9316fd3ec704dd1597 (patch) | |
tree | 76ed10c2bc35636345437ee00a9140c5bc6edd5c /main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderTemplateConfigurePage.cs | |
parent | 84ac6bfe31355f42f2c6964049c570133909c9d7 (diff) |
Use a table for layout
Diffstat (limited to 'main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderTemplateConfigurePage.cs')
-rw-r--r-- | main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderTemplateConfigurePage.cs | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderTemplateConfigurePage.cs b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderTemplateConfigurePage.cs index 38d27db16d..12cc47599c 100644 --- a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderTemplateConfigurePage.cs +++ b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderTemplateConfigurePage.cs @@ -40,20 +40,22 @@ namespace MonoDevelop.AspNetCore.Scaffolding protected override Widget GetMainControl () { - var vbox = new VBox (); - foreach (var field in scaffolder.Fields) { - var hbox = new HBox (); + var table = new Table (); + //TODO: may as well just make Fields an array or list + var fields = scaffolder.Fields.ToArray (); + + for(int row = 0; row < fields.Count (); row++) { + var field = fields[row]; var label = new Label (); switch (field) { case StringField s: var input = new TextEntry (); input.HeightRequest = 30; - hbox.PackEnd (input); label.Font = label.Font.WithSize (15); label.Text = s.DisplayName; - hbox.PackEnd (label); - vbox.PackStart (hbox); + table.Add (label, 0, row, hpos:WidgetPlacement.End); + table.Add (input, 1, row); input.Changed += (sender, args) => s.SelectedValue = input.Text; break; case ComboField comboField: @@ -69,12 +71,11 @@ namespace MonoDevelop.AspNetCore.Scaffolding } comboBox.HeightRequest = 30; - hbox.PackEnd (comboBox); label.Font = label.Font.WithSize (15); label.Text = comboField.DisplayName; - hbox.PackEnd (label); - vbox.PackStart (hbox); + table.Add (label, 0, row, hpos:WidgetPlacement.End); + table.Add (comboBox, 1, row); comboField.SelectedValue = comboField.Options.FirstOrDefault (); comboBox.TextInput += (sender, args) => comboField.SelectedValue = comboBox.SelectedText; @@ -83,21 +84,21 @@ namespace MonoDevelop.AspNetCore.Scaffolding break; case BoolFieldList boolFieldList: label.Text = boolFieldList.DisplayName; - hbox.PackEnd (label); + table.Add (label, 0, row, hpos:WidgetPlacement.End, vpos:WidgetPlacement.Start); + var vbox = new VBox (); for(int i = 0; i < boolFieldList.Options.Count; i++) { - var checkHbox = new HBox (); var boolField = boolFieldList.Options [i]; var checkbox = new CheckBox (boolField.DisplayName); - checkHbox.PackEnd (checkbox); + checkbox.HeightRequest = 15; checkbox.Toggled += (sender, args) => boolField.Selected = checkbox.Active; - hbox.PackEnd (checkHbox); + vbox.PackStart (checkbox); } - vbox.PackStart (hbox); + table.Add (vbox, 1, row); break; } } - return vbox; + return table; } public override int GetHashCode () |