Skip to main content

Element

Trait Element 

Source
pub trait Element: EventHandler {
    // Required methods
    fn rect(&self) -> Rect;
    fn set_rect(&mut self, rect: Rect);
    fn render(&self, canvas: &mut Canvas, z: i32);
    fn focus_id(&self) -> Option<FocusId>;
}
Expand description

Trait implemented by all renderable UI elements.

Designed for object safety so that external crates (e.g., a future jag-media) can implement it for their own element types.

Required Methods§

Source

fn rect(&self) -> Rect

The bounding rectangle of this element in logical coordinates.

Source

fn set_rect(&mut self, rect: Rect)

Update the bounding rectangle (typically called by the layout engine).

Source

fn render(&self, canvas: &mut Canvas, z: i32)

Paint this element onto canvas at the given z-index.

Source

fn focus_id(&self) -> Option<FocusId>

The focus identifier for this element, if it is focusable.

Implementors§