pub trait Widget {
// Required methods
fn render(
&mut self,
scene: &mut dyn Scene,
theme: &mut dyn Theme,
layout_node: &LayoutNode,
info: &AppInfo,
context: AppContext,
);
fn layout_style(&self) -> StyleNode;
fn update(
&mut self,
layout: &LayoutNode,
context: AppContext,
info: &AppInfo,
) -> Update;
fn widget_id(&self) -> WidgetId;
}Expand description
The base trait for all widgets.
Required Methods§
Sourcefn render(
&mut self,
scene: &mut dyn Scene,
theme: &mut dyn Theme,
layout_node: &LayoutNode,
info: &AppInfo,
context: AppContext,
)
fn render( &mut self, scene: &mut dyn Scene, theme: &mut dyn Theme, layout_node: &LayoutNode, info: &AppInfo, context: AppContext, )
Render the widget to the canvas.
Sourcefn layout_style(&self) -> StyleNode
fn layout_style(&self) -> StyleNode
Return the layout style node for layout computation.
Sourcefn update(
&mut self,
layout: &LayoutNode,
context: AppContext,
info: &AppInfo,
) -> Update
fn update( &mut self, layout: &LayoutNode, context: AppContext, info: &AppInfo, ) -> Update
Update the widget state with given info and layout. Returns if the app should be updated.