Skip to main content

Widget

Trait Widget 

Source
pub trait Widget:
    Debug
    + Send
    + Sync {
    // Required methods
    fn id(&self) -> WidgetId;
    fn rect(&self) -> Rect;
    fn set_rect(&mut self, rect: Rect);
    fn draw(&self, dl: &mut DrawList, theme: &Theme);
    fn handle_input(
        &mut self,
        input: &UiInput,
        events: &mut Vec<UiEvent>,
        theme: &Theme,
        dt: f32,
    );

    // Provided methods
    fn is_visible(&self) -> bool { ... }
    fn preferred_size(&self) -> (SizeConstraint, SizeConstraint) { ... }
    fn update(&mut self, _dt: f32) { ... }
}
Expand description

A UI widget that can draw itself and handle input.

Required Methods§

Source

fn id(&self) -> WidgetId

Source

fn rect(&self) -> Rect

Source

fn set_rect(&mut self, rect: Rect)

Source

fn draw(&self, dl: &mut DrawList, theme: &Theme)

Source

fn handle_input( &mut self, input: &UiInput, events: &mut Vec<UiEvent>, theme: &Theme, dt: f32, )

Provided Methods§

Implementors§