Trait termwiz::widgets::Widget[][src]

pub trait Widget {
    fn render(&mut self, args: &mut RenderArgs<'_>);

    fn get_size_constraints(&self) -> Constraints { ... }
fn process_event(
        &mut self,
        _event: &WidgetEvent,
        _args: &mut UpdateArgs<'_>
    ) -> bool { ... } }

Implementing the Widget trait allows for defining a potentially interactive component in a UI layout.

Required methods

fn render(&mut self, args: &mut RenderArgs<'_>)[src]

Draw the widget to the RenderArgs::surface, and optionally update RenderArgs::cursor to reflect the cursor position and display attributes.

Loading content...

Provided methods

fn get_size_constraints(&self) -> Constraints[src]

Override this to have your widget specify its layout constraints. You may wish to have your widget constructor receive a Constraints instance to make this more easily configurable in more generic widgets.

fn process_event(
    &mut self,
    _event: &WidgetEvent,
    _args: &mut UpdateArgs<'_>
) -> bool
[src]

Override this to allow your widget to respond to keyboard, mouse and other widget events. Return true if your widget handled the event, or false to allow the event to propagate to the widget parent.

Loading content...

Implementors

Loading content...