Trait relm::Widget
[−]
[src]
pub trait Widget where
Self: Update,
Self::Root: Clone + IsA<Object> + IsA<Widget>, { type Root; fn root(&self) -> Self::Root; fn view(relm: &Relm<Self>, model: Self::Model) -> Self; fn init_view(&mut self) { ... } fn on_add<W: IsA<Widget> + IsA<Object>>(&self, _parent: W) { ... } fn parent_id() -> Option<&'static str> { ... } fn run(model_param: Self::ModelParam) -> Result<(), ()>
where
Self: 'static, { ... } }
Trait to implement to manage widget's events.
Associated Types
type Root
The type of the root widget.
Required Methods
fn root(&self) -> Self::Root
Get the root widget of the view.
fn view(relm: &Relm<Self>, model: Self::Model) -> Self
Create the initial view.
Provided Methods
fn init_view(&mut self)
Update the view after it is initially created.
This method is only useful when using the #[widget]
attribute, because when not using it,
you can use the view()
method instead.
fn on_add<W: IsA<Widget> + IsA<Object>>(&self, _parent: W)
Method called when the widget is added to its parent.
fn parent_id() -> Option<&'static str>
Get the parent ID.
This is useful for custom Container implementation: when you implement the
Container::add_widget()
, you might want to
insert widgets elsewhere depending of this id.
fn run(model_param: Self::ModelParam) -> Result<(), ()> where
Self: 'static,
Self: 'static,
Create the window from this widget and start the main loop.