pub struct Focusable { /* private fields */ }
Expand description

An Entity that can be navigated to using the ui navigation system.

It is in one of multiple FocusState, you can check its state with the Focusable::state method or any of the is_* Focusable methods.

A Focusable can be Focusable::cancel. Meaning: when you send the NavRequest::Action request while a cancel Focusable is focused, it will act as if the NavRequest::Cancel request was received.

A Focusable can also be Focusable::lock. Meaning: when you send the NavRequest::Action request while a lock Focusable is focused, it will prevent all further processing of NavRequests and emit a NavEvent::Locked.

Only by sending a NavRequest::Free will the navigation system resume processing new NavRequests. It will send a NavEvent::Unlocked just before.

Implementations

The state of this Focusable

This Focusable is the unique focused element

All navigation requests start from it.

To set an arbitrary Focusable to focused, you should send a NavRequest::FocusOn request.

This Focusable is active

Meaning it is either the focused element or one of the Focusable on the path to it. All Focusables to the path to the focused element are active.

This Focusable is dormant

When focus leaves a specific Focusable without being acquired by a sibling, it becomes dormant. When focus comes back to the encompassing NavMenu, the focused element will be the dormant element within the menu.

This Focusable is neither active, focused or dormant

This Focusable is a cancel focusable, see Focusable::cancel

This Focusable is a locking focusable, see Focusable::lock

This is a “Cancel” focusable

Whenever a NavRequest::Action is sent while this Focusable is focused, act as if the request was a NavRequest::Cancel

This is a “Lock” focusable

Whenever a NavRequest::Action is sent while this Focusable is focused, the navigation system stops processing new NavRequests until it receives NavRequest::Free.

This is useful to implement widgets with complex controls you don’t want to accidentally unfocus, or suspending the navigation system while in-game.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Creates Self using data from the given [World]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more