Widget

Trait Widget 

Source
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§

Source

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.

Source

fn layout_style(&self) -> StyleNode

Return the layout style node for layout computation.

Source

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.

Source

fn widget_id(&self) -> WidgetId

Return the widget id.

Implementors§