whitespace

This commit is contained in:
Max Bradbury 2020-10-04 12:18:58 +01:00
parent 40268c891b
commit dcfa5db45d
1 changed files with 8 additions and 1 deletions

View File

@ -164,7 +164,9 @@ fn main() {
let ui = UI::init().unwrap(); let ui = UI::init().unwrap();
// Initialize the state of the application. // Initialize the state of the application.
let state = Rc::new(RefCell::new(State { slider_val: 0, spinner_val: 0, entry_val: "".into(), multi_val: "".into() })); let state = Rc::new(RefCell::new(
State { slider_val: 0, spinner_val: 0, entry_val: "".into(), multi_val: "".into() }
));
// Set up the inputs for the application. // Set up the inputs for the application.
// While it's not necessary to create a block for this, it makes the code a lot easier // While it's not necessary to create a block for this, it makes the code a lot easier
@ -173,14 +175,17 @@ fn main() {
let (input_group, mut slider, mut spinner, mut entry, mut multi) = { let (input_group, mut slider, mut spinner, mut entry, mut multi) = {
// The group will hold all the inputs // The group will hold all the inputs
let mut input_group = Group::new(&ui, "Inputs"); let mut input_group = Group::new(&ui, "Inputs");
// The vertical box arranges the inputs within the groups // The vertical box arranges the inputs within the groups
let mut input_vbox = VerticalBox::new(&ui); let mut input_vbox = VerticalBox::new(&ui);
input_vbox.set_padded(&ui, true); input_vbox.set_padded(&ui, true);
// Numerical inputs // Numerical inputs
let slider = Slider::new(&ui, 1, 100); let slider = Slider::new(&ui, 1, 100);
let spinner = Spinbox::new(&ui, 1, 100); let spinner = Spinbox::new(&ui, 1, 100);
let entry = Entry::new(&ui); let entry = Entry::new(&ui);
let multi = MultilineEntry::new(&ui); let multi = MultilineEntry::new(&ui);
// Add everything in hierarchy // Add everything in hierarchy
// Note the reverse order here. Again, it's not necessary, but it improves // Note the reverse order here. Again, it's not necessary, but it improves
// readability. // readability.
@ -192,6 +197,7 @@ fn main() {
input_vbox.append(&ui, entry.clone(), LayoutStrategy::Compact); input_vbox.append(&ui, entry.clone(), LayoutStrategy::Compact);
input_vbox.append(&ui, multi.clone(), LayoutStrategy::Stretchy); input_vbox.append(&ui, multi.clone(), LayoutStrategy::Stretchy);
input_group.set_child(&ui, input_vbox); input_group.set_child(&ui, input_vbox);
(input_group, slider, spinner, entry, multi) (input_group, slider, spinner, entry, multi)
}; };
@ -209,6 +215,7 @@ fn main() {
output_vbox.append(&ui, text_label.clone(), LayoutStrategy::Compact); output_vbox.append(&ui, text_label.clone(), LayoutStrategy::Compact);
output_vbox.append(&ui, bigtext_label.clone(), LayoutStrategy::Stretchy); output_vbox.append(&ui, bigtext_label.clone(), LayoutStrategy::Stretchy);
output_group.set_child(&ui, output_vbox); output_group.set_child(&ui, output_vbox);
(output_group, add_label, sub_label, text_label, bigtext_label) (output_group, add_label, sub_label, text_label, bigtext_label)
}; };