Skip to main content

Widget

Trait Widget 

Source
pub trait Widget {
    // Required method
    fn render(&mut self, ui: &mut dyn UiCtx);

    // Provided methods
    fn a11y_role(&self) -> A11yRole { ... }
    fn a11y_label(&self) -> Option<String> { ... }
    fn a11y_description(&self) -> Option<String> { ... }
}
Expand description

A UI widget that can render itself into a UiCtx.

Required Methods§

Source

fn render(&mut self, ui: &mut dyn UiCtx)

Render the widget into ui.

Provided Methods§

Source

fn a11y_role(&self) -> A11yRole

Return the accessibility role for this widget.

Adapters call this to populate the a11y tree without requiring a full oxiui-accessibility dependency in core. The default returns A11yRole::Unknown.

Source

fn a11y_label(&self) -> Option<String>

Return a human-readable accessibility label for this widget.

Used as the accessible name. Returns None by default (no label).

Source

fn a11y_description(&self) -> Option<String>

Return an accessibility description (longer hint text) for this widget.

Returns None by default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§