cursive/examples/src/bin/fixed_layout.rs

25 lines
752 B
Rust
Raw Normal View History

2020-06-30 01:00:57 +00:00
use cursive::{
views::{Button, FixedLayout, TextView},
Rect,
};
2020-06-29 22:24:41 +00:00
fn main() {
let mut siv = cursive::default();
siv.add_layer(
cursive::views::Dialog::around(
2020-06-30 01:00:57 +00:00
FixedLayout::new()
.child(Rect::from_size((0, 0), (1, 1)), TextView::new("/"))
.child(Rect::from_size((14, 0), (1, 1)), TextView::new(r"\"))
.child(Rect::from_size((0, 2), (1, 1)), TextView::new(r"\"))
.child(Rect::from_size((14, 2), (1, 1)), TextView::new("/"))
.child(
Rect::from_size((2, 1), (11, 1)),
Button::new("Click me!", |s| s.quit()),
),
2020-06-29 22:24:41 +00:00
)
.button("Quit", |s| s.quit()),
);
siv.run();
}