pub trait Widget: 'static {
// Required methods
fn id(&self) -> &str;
fn open(&mut self, ui: &mut UiContext<'_>);
fn update(&mut self, ui: &mut UiContext<'_>) -> Status;
// Provided methods
fn resume(&mut self, value: Option<Value>, ui: &mut UiContext<'_>) { ... }
fn value(&self, item: &str) -> Option<Value> { ... }
fn music(&self) -> Option<&str> { ... }
}Expand description
A virtual UI element. Implement this to create your own widgets.
Required Methods§
Provided Methods§
Sourcefn resume(&mut self, value: Option<Value>, ui: &mut UiContext<'_>)
fn resume(&mut self, value: Option<Value>, ui: &mut UiContext<'_>)
Called when the widget becomes the top again after the one above closed.
value is what the closed widget passed with Status::CloseWith.
Sourcefn music(&self) -> Option<&str>
fn music(&self) -> Option<&str>
Music that plays while this widget is open, see Menu::music.
Widgets above it without music of their own keep it playing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".