mirror of
https://github.com/danbulant/cushy
synced 2026-05-19 04:08:38 +00:00
The overlay example now supports right-clicking to open overlays at the clicked location, showing how a context menu widget can begin being built.
20 lines
611 B
Rust
20 lines
611 B
Rust
use cushy::value::{Destination, Dynamic, Source};
|
|
use cushy::widget::MakeWidget;
|
|
use cushy::widgets::checkbox::{Checkable, CheckboxState};
|
|
use cushy::Run;
|
|
|
|
fn main() -> cushy::Result {
|
|
let checkbox_state = Dynamic::new(CheckboxState::Checked);
|
|
let label = checkbox_state.map_each(|state| format!("Check Me! Current: {state:?}"));
|
|
|
|
checkbox_state
|
|
.clone()
|
|
.to_checkbox(label)
|
|
.and("Maybe".into_button().on_click(move |_| {
|
|
checkbox_state.set(CheckboxState::Indeterminant);
|
|
}))
|
|
.into_columns()
|
|
.centered()
|
|
.expand()
|
|
.run()
|
|
}
|