cushy/examples/window-properties.rs
Jonathan Johnson 2fe28729df
Directly depending on figures
While this was a workaround for a docs.rs issue (Px/Lp are not
linked), I decided having the shorter import path would look better in
the examples.

It probably wasn't necessary to update all of the references in the
internal code, but I decided it was worth the consistency.
2023-12-28 09:35:24 -08:00

23 lines
697 B
Rust

use cushy::value::Dynamic;
use cushy::widget::{MakeWidget, WidgetInstance};
use cushy::Run;
use figures::Size;
fn main() -> cushy::Result {
let focused = Dynamic::new(false);
let occluded = Dynamic::new(false);
let inner_size = Dynamic::new(Size::default());
let widgets = focused
.map_each(|v| format!("focused: {:?}", v))
.and(occluded.map_each(|v| format!("occluded: {:?}", v)))
.and(inner_size.map_each(|v| format!("inner_size: {:?}", v)))
.into_rows()
.centered();
cushy::window::Window::<WidgetInstance>::for_widget(widgets)
.focused(focused)
.occluded(occluded)
.inner_size(inner_size)
.run()
}