extern crate libui;
use libui::controls::{Button, Group, Label, VerticalBox};
use libui::prelude::*;
fn main() {
let ui = UI::init().expect("Couldn't initialize UI library");
let mut win = Window::new(&ui.clone(), "Test App", 200, 200, WindowType::NoMenubar);
let mut vbox = VerticalBox::new();
vbox.set_padded(true);
let mut group_vbox = VerticalBox::new();
let mut group = Group::new("Group");
let mut button = Button::new("Button");
button.on_clicked({
move |btn| {
btn.set_text("Clicked!");
}
});
let mut quit_button = Button::new("Quit");
quit_button.on_clicked({
let ui = ui.clone();
move |_| {
ui.quit();
}
});
let mut label_text = String::new();
label_text.push_str("There is a ton of text in this label.\n");
label_text.push_str("Pretty much every unicode character is supported.\n");
label_text.push_str("π η¨ζ·ηι’ μ¬μ©μ μΈν°νμ΄μ€");
let label = Label::new(&label_text);
vbox.append(label, LayoutStrategy::Stretchy);
group_vbox.append(button, LayoutStrategy::Compact);
group_vbox.append(quit_button, LayoutStrategy::Compact);
group.set_child(group_vbox);
vbox.append(group, LayoutStrategy::Compact);
win.set_child(vbox);
win.show();
ui.main();
}