logo
pub trait Widget<Message, Renderer> {
    fn width(&self) -> Length;
    fn height(&self) -> Length;
    fn layout(&self, renderer: &Renderer, limits: &Limits) -> Node;
    fn draw(
        &self,
        state: &Tree,
        renderer: &mut Renderer,
        style: &Style,
        layout: Layout<'_>,
        cursor_position: Point,
        viewport: &Rectangle<f32>
    ); fn tag(&self) -> Tag { ... } fn state(&self) -> State { ... } fn children(&self) -> Vec<Tree, Global>Notable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
    A: Allocator
{ ... } fn diff(&self, _tree: &mut Tree) { ... } fn on_event(
        &mut self,
        _state: &mut Tree,
        _event: Event,
        _layout: Layout<'_>,
        _cursor_position: Point,
        _renderer: &Renderer,
        _clipboard: &mut dyn Clipboard,
        _shell: &mut Shell<'_, Message>
    ) -> Status { ... } fn mouse_interaction(
        &self,
        _state: &Tree,
        _layout: Layout<'_>,
        _cursor_position: Point,
        _viewport: &Rectangle<f32>,
        _renderer: &Renderer
    ) -> Interaction { ... } fn overlay(
        &'a self,
        _state: &'a mut Tree,
        _layout: Layout<'_>,
        _renderer: &Renderer
    ) -> Option<Element<'a, Message, Renderer>> { ... } }
Available on crate feature pure only.
Expand description

A component that displays information and allows interaction.

If you want to build your own widgets, you will need to implement this trait.

Required Methods

Returns the width of the Widget.

Returns the height of the Widget.

Returns the layout::Node of the Widget.

This layout::Node is used by the runtime to compute the Layout of the user interface.

Draws the Widget using the associated Renderer.

Provided Methods

Returns the Tag of the Widget.

Returns the State of the Widget.

Returns the state Tree of the children of the Widget.

Reconciliates the Widget with the provided Tree.

Processes a runtime Event.

By default, it does nothing.

Returns the current mouse::Interaction of the Widget.

By default, it returns mouse::Interaction::Idle.

Returns the overlay of the Widget, if there is any.

Implementations on Foreign Types

Implementors