etui/focus

Types

Ordered ring of focus slot IDs. Exactly one slot is active at a time.

pub type FocusRing {
  FocusRing(ids: List(String), current: Int)
}

Constructors

  • FocusRing(ids: List(String), current: Int)

Values

pub fn current_index(ring: FocusRing) -> Int

0-based index of the currently focused slot.

pub fn focus_id(ring: FocusRing, id: String) -> FocusRing

Move focus to the slot with the given id. No-op if id not found.

pub fn focus_index(ring: FocusRing, idx: Int) -> FocusRing

Move focus to the slot at the given index (clamped to valid range).

pub fn focus_new(ids: List(String)) -> FocusRing

Create a focus ring from a list of slot IDs. The first slot starts focused. Empty list creates an inert ring.

pub fn focus_next(ring: FocusRing) -> FocusRing

Move focus to the next slot (wraps around).

pub fn focus_prev(ring: FocusRing) -> FocusRing

Move focus to the previous slot (wraps around).

pub fn focused(ring: FocusRing) -> Result(String, Nil)

ID of the currently focused slot, or None if the ring is empty.

pub fn is_focused(ring: FocusRing, id: String) -> Bool

True if id is the currently focused slot.

pub fn size(ring: FocusRing) -> Int

Total number of slots in the ring.

Search Document