cursive/examples/dialog.rs

24 lines
627 B
Rust
Raw Normal View History

2015-05-16 21:02:15 +00:00
extern crate cursive;
2019-01-24 19:57:30 +00:00
use cursive::views::{CircularFocus, Dialog, TextView};
2018-06-11 06:29:10 +00:00
use cursive::Cursive;
2015-05-16 21:02:15 +00:00
fn main() {
2016-06-26 00:10:18 +00:00
// Creates the cursive root - required for every application.
let mut siv = Cursive::default();
2015-05-16 21:02:15 +00:00
// Creates a dialog with a single "Quit" button
2017-10-12 23:38:55 +00:00
siv.add_layer(
2018-01-16 02:55:27 +00:00
// Most views can be configured in a chainable way
2019-01-24 19:57:30 +00:00
CircularFocus::wrap_tab(
Dialog::around(TextView::new("Hello Dialog!"))
.title("Cursive")
2019-02-22 23:30:22 +00:00
.button("Foo", |_s| ())
2019-01-24 19:57:30 +00:00
.button("Quit", |s| s.quit()),
),
2017-10-12 23:38:55 +00:00
);
2015-05-16 21:02:15 +00:00
2016-06-26 00:10:18 +00:00
// Starts the event loop.
2015-05-16 21:02:15 +00:00
siv.run();
}