Skip to main content

Element

Trait Element 

Source
pub trait Element: Send + Sync {
    // Required methods
    fn id(&self) -> ElementId;
    fn on_metadata_update(&self, metadata: &ElementMetadata);
    fn on_render(&self);
    fn on_keyboard(&self, event: &KeyboardEvent) -> bool;
    fn on_mouse(&self, event: &MouseEvent) -> bool;
    fn on_focus_gain(&self);
    fn on_focus_loss(&self);
    fn on_tick(&self);
}
Expand description

Trait for elements that can be registered with the layout manager.

Required Methods§

Source

fn id(&self) -> ElementId

Returns the element’s unique identifier.

Source

fn on_metadata_update(&self, metadata: &ElementMetadata)

Called when the element’s metadata is updated.

Source

fn on_render(&self)

Called when the element should render itself.

Source

fn on_keyboard(&self, event: &KeyboardEvent) -> bool

Called when the element receives keyboard input.

Source

fn on_mouse(&self, event: &MouseEvent) -> bool

Called when the element receives mouse input.

Source

fn on_focus_gain(&self)

Called when the element receives focus.

Source

fn on_focus_loss(&self)

Called when the element loses focus.

Source

fn on_tick(&self)

Called on each tick event.

Implementors§