Trait rgx::ui::widgets::widget::Widget

source ·
pub trait Widget<T> {
    // Required method
    fn paint(&mut self, canvas: Canvas<'_>, data: &T);

    // Provided methods
    fn layout(
        &mut self,
        parent: Size,
        ctx: &LayoutCtx<'_>,
        data: &T,
        env: &Env
    ) -> Size { ... }
    fn update(&mut self, ctx: &Context<'_>, data: &T) { ... }
    fn event(
        &mut self,
        event: &WidgetEvent,
        ctx: &Context<'_>,
        data: &mut T
    ) -> ControlFlow<()> { ... }
    fn lifecycle(
        &mut self,
        lifecycle: &WidgetLifecycle<'_>,
        ctx: &Context<'_>,
        data: &T,
        env: &Env
    ) { ... }
    fn frame(&mut self, surfaces: &Surfaces, data: &mut T) { ... }
    fn cursor(&self) -> Option<&'static str> { ... }
    fn contains(&self, point: Point) -> bool { ... }
    fn display(&self) -> String { ... }
}
Expand description

A UI widget that can be painted on screen.

Required Methods§

source

fn paint(&mut self, canvas: Canvas<'_>, data: &T)

Paint the widget.

Provided Methods§

source

fn layout( &mut self, parent: Size, ctx: &LayoutCtx<'_>, data: &T, env: &Env ) -> Size

Compute the widget layout.

source

fn update(&mut self, ctx: &Context<'_>, data: &T)

Update the widget’s appearance.

source

fn event( &mut self, event: &WidgetEvent, ctx: &Context<'_>, data: &mut T ) -> ControlFlow<()>

Process an external event.

source

fn lifecycle( &mut self, lifecycle: &WidgetLifecycle<'_>, ctx: &Context<'_>, data: &T, env: &Env )

Process a lifecycle event.

source

fn frame(&mut self, surfaces: &Surfaces, data: &mut T)

Handle the end of the frame.

source

fn cursor(&self) -> Option<&'static str>

Get the cursor to display over this widget.

source

fn contains(&self, point: Point) -> bool

Check whether this widget contains a point.

source

fn display(&self) -> String

Display this widget in text.

Trait Implementations§

source§

impl<T> Widget<T> for Box<dyn Widget<T>>

source§

fn layout( &mut self, parent: Size, ctx: &LayoutCtx<'_>, data: &T, env: &Env ) -> Size

Compute the widget layout.
source§

fn update(&mut self, ctx: &Context<'_>, data: &T)

Update the widget’s appearance.
source§

fn paint(&mut self, canvas: Canvas<'_>, data: &T)

Paint the widget.
source§

fn event( &mut self, event: &WidgetEvent, ctx: &Context<'_>, data: &mut T ) -> ControlFlow<()>

Process an external event.
source§

fn lifecycle( &mut self, lifecycle: &WidgetLifecycle<'_>, ctx: &Context<'_>, data: &T, env: &Env )

Process a lifecycle event.
source§

fn frame(&mut self, surfaces: &Surfaces, data: &mut T)

Handle the end of the frame.
source§

fn cursor(&self) -> Option<&'static str>

Get the cursor to display over this widget.
source§

fn contains(&self, point: Point) -> bool

Check whether this widget contains a point.
source§

fn display(&self) -> String

Display this widget in text.

Implementations on Foreign Types§

source§

impl<T> Widget<T> for Box<dyn Widget<T>>

source§

fn layout( &mut self, parent: Size, ctx: &LayoutCtx<'_>, data: &T, env: &Env ) -> Size

source§

fn update(&mut self, ctx: &Context<'_>, data: &T)

source§

fn paint(&mut self, canvas: Canvas<'_>, data: &T)

source§

fn event( &mut self, event: &WidgetEvent, ctx: &Context<'_>, data: &mut T ) -> ControlFlow<()>

source§

fn lifecycle( &mut self, lifecycle: &WidgetLifecycle<'_>, ctx: &Context<'_>, data: &T, env: &Env )

source§

fn frame(&mut self, surfaces: &Surfaces, data: &mut T)

source§

fn cursor(&self) -> Option<&'static str>

source§

fn contains(&self, point: Point) -> bool

source§

fn display(&self) -> String

Implementors§

source§

impl<T> Widget<T> for Image

source§

impl<T> Widget<T> for Rgba8

source§

impl<T> Widget<T> for Interactive<T>

source§

impl<T> Widget<T> for Text

source§

impl<T> Widget<T> for Align<T>

source§

impl<T> Widget<T> for Button<T>

source§

impl<T> Widget<T> for HStack<T>

source§

impl<T> Widget<T> for Painter<T>

source§

impl<T> Widget<T> for SizedBox<T>

source§

impl<T> Widget<T> for ZStack<T>

source§

impl<T, W: Widget<T>> Widget<T> for Pod<T, W>

source§

impl<T, W: Widget<T>, C: Controller<T, W>> Widget<T> for Control<W, C>