mirror of
https://github.com/danbulant/cushy
synced 2026-06-11 10:30:49 +00:00
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.
23 lines
697 B
Rust
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()
|
|
}
|