pub trait Widget<E, M>: Handleable<E, M> + Renderable + Object + Debug {
// Required method
fn type_id(&self) -> TypeId;
// Provided methods
fn data<'c, D>(&self, cap: &'c dyn Cap) -> &'c D
where Self: Sized,
D: 'static { ... }
fn data_mut<'c, D>(&self, cap: &'c mut dyn MutCap<E, M>) -> &'c mut D
where Self: Sized,
D: 'static { ... }
}
Expand description
A widget as used by a Ui
.
In addition to taking care of Id
management and
parent-child relationships, the Ui
is responsible for dispatching
events to widgets and rendering them. Hence, a widget usable for the
Ui
needs to implement Handleable
, Renderable
, and
Object
.