Skip to main content

GuiWidget

Trait GuiWidget 

Source
pub trait GuiWidget<X: GXExt>: Send + 'static {
    // Required methods
    fn handle_update(
        &mut self,
        rt: &Handle,
        id: ExprId,
        v: &Value,
    ) -> Result<bool>;
    fn view(&self) -> IcedElement<'_>;

    // Provided method
    fn editor_action(
        &mut self,
        id: ExprId,
        action: &Action,
    ) -> Option<(CallableId, Value)> { ... }
}
Expand description

Trait for GUI widgets. Unlike TUI widgets, GUI widgets are not async — handle_update is synchronous, and the view method builds an iced Element tree.

Required Methods§

Source

fn handle_update(&mut self, rt: &Handle, id: ExprId, v: &Value) -> Result<bool>

Process a value update from graphix. Widgets that own child refs use rt to block_on recompilation of their subtree. Returns true if the widget changed and the window should redraw.

Source

fn view(&self) -> IcedElement<'_>

Build the iced Element tree for rendering.

Provided Methods§

Source

fn editor_action( &mut self, id: ExprId, action: &Action, ) -> Option<(CallableId, Value)>

Route a text editor action to the widget that owns the given content ref. Returns Some((callable_id, value)) if the action was an edit and the result should be called back to graphix.

Implementors§