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§
Sourcefn on_metadata_update(&self, metadata: &ElementMetadata)
fn on_metadata_update(&self, metadata: &ElementMetadata)
Called when the element’s metadata is updated.
Sourcefn on_keyboard(&self, event: &KeyboardEvent) -> bool
fn on_keyboard(&self, event: &KeyboardEvent) -> bool
Called when the element receives keyboard input.
Sourcefn on_mouse(&self, event: &MouseEvent) -> bool
fn on_mouse(&self, event: &MouseEvent) -> bool
Called when the element receives mouse input.
Sourcefn on_focus_gain(&self)
fn on_focus_gain(&self)
Called when the element receives focus.
Sourcefn on_focus_loss(&self)
fn on_focus_loss(&self)
Called when the element loses focus.