ui_controls

module pkg::alloy::ui::widgetssource

The base widgets: text, buttons, checkboxes, sliders and images, each describing itself to screen readers.

fn text_layoutsource

exp fn text_layout(
    arrange: &var Arrange,
    text: &[u8],
    size: f32,
    weight: u32,
    width: f32
) -> text::Layout

The text laid out in the theme's font, on one line when it fits the width and wrapped at the width when not, its lines at the element's start.

fn paintsource

exp fn paint(self t: &Text, look: &Look, paint: &var Paint)

fn renewsource

exp fn renew(self t: &var Text, next: Text) -> Change

fn saidsource

exp fn said(accessible: &String, shown: &String) -> String

The label a screen reader says: the accessible text, else the visible.

fn button_layoutsource

exp fn button_layout(
    arrange: &var Arrange,
    label: &String,
    padding: &Padding,
    limits: Limits,
    laid: &var Option<*text::Layout>
) -> Extent

A button's label laid out within its padding, kept in laid: its size.

fn paintsource

exp fn paint(self b: &Button, look: &Look, paint: &var Paint)

fn paint_buttonsource

exp fn paint_button(
    laid: &Option<*text::Layout>,
    variant: ButtonVariant,
    enabled: bool,
    held: bool,
    look: &Look,
    paint: &var Paint
)

A button's fill, focus ring and label, as pressed when held.

const SETTLEsource

exp const SETTLE: u64 = 400000000;

How long after a change, in nanoseconds, a built-in widget's own drawing may still move: past the theme's short duration, which its motion takes.

fn settledsource

exp fn settled(look: &Look) -> f32

How far along a built-in widget's own motion is, since its change: over the theme's short duration.

fn shadesource

exp fn shade(color: Color, amount: f32, plain: bool) -> Color

The color darkened by the amount, or for a plain button a tint of its own color that hovering shows.

fn claimssource

exp fn claims(input: &Input) -> bool

Whether a control takes the input it was given: all but focus changes and the wheel, which goes on to the scrolling ancestor.

fn activatessource

exp fn activates(k: &KeyEvent) -> bool

Whether the key presses what has the focus: Enter or Space.

fn focus_ringsource

exp fn focus_ring(look: &Look, paint: &var Paint, area: Rect, radius: f32)

The theme's focus ring around the area.

fn renewsource

exp fn renew(self b: &var Button, next: Button) -> Change

fn paintsource

exp fn paint(self c: &Checkbox, look: &Look, paint: &var Paint)

fn renewsource

exp fn renew(self c: &var Checkbox, next: Checkbox) -> Change

fn paintsource

exp fn paint(self s: &Slider, look: &Look, paint: &var Paint)

Its label at its start, the track after it, the minimum at the track's start: the right right to left. Lengths from the start, made x from the left as drawn.

fn renewsource

exp fn renew(self s: &var Slider, next: Slider) -> Change

fn paintsource

exp fn paint(self i: &Image, look: &Look, paint: &var Paint)

fn renewsource

exp fn renew(self i: &var Image, next: Image) -> Change