zng_ext_input::focus

Struct WidgetFocusInfo

source
pub struct WidgetFocusInfo { /* private fields */ }
Expand description

WidgetInfo wrapper that adds focus information for each widget.

Implementations§

source§

impl WidgetFocusInfo

source

pub fn new( widget_info: WidgetInfo, focus_disabled_widgets: bool, focus_hidden_widgets: bool, ) -> Self

Wrap a widget_info reference to enable focus info querying.

See the FOCUS.focus_disabled_widgets and FOCUS.focus_hidden_widgets config for more details on the parameters.

source

pub fn info(&self) -> &WidgetInfo

Full widget info.

source

pub fn focus_disabled_widgets(&self) -> bool

If DISABLED widgets are focusable in this tree.

See the FOCUS.focus_disabled_widgets config for more details.

source

pub fn focus_hidden_widgets(&self) -> bool

If Hidden widgets are focusable in this tree.

See the FOCUS.focus_hidden_widgets config for more details.

source

pub fn root(&self) -> Self

Root focusable.

source

pub fn focus_tree(&self) -> FocusInfoTree

Clone a reference to the FocusInfoTree that owns this widget.

source

pub fn is_focusable(&self) -> bool

If the widget is focusable.

§Note

This is probably true, the only way to get a WidgetFocusInfo for a non-focusable widget is by calling into_focus_info or explicitly constructing one.

Focus scopes are also focusable.

source

pub fn is_scope(&self) -> bool

Is focus scope.

source

pub fn is_alt_scope(&self) -> bool

Is ALT focus scope.

source

pub fn nested_window(&self) -> Option<WindowId>

Gets the nested window ID, if this widget hosts a nested window.

Nested window hosts always focus the nested window on focus.

source

pub fn nested_window_tree(&self) -> Option<FocusInfoTree>

Gets the nested window focus tree, if this widget hosts a nested window.

source

pub fn focus_info(&self) -> FocusInfo

Widget focus metadata.

source

pub fn focus_info_ignore_blocked(&self) -> FocusInfo

Widget focus metadata, all things equal except the widget interactivity is blocked.

source

pub fn ancestors(&self) -> impl Iterator<Item = WidgetFocusInfo>

Iterator over focusable parent -> grandparent -> .. -> root.

source

pub fn self_and_ancestors(&self) -> impl Iterator<Item = WidgetFocusInfo>

Iterator over self -> focusable parent -> grandparent -> .. -> root.

source

pub fn scopes(&self) -> impl Iterator<Item = WidgetFocusInfo>

Iterator over focus scopes parent -> grandparent -> .. -> root.

source

pub fn parent(&self) -> Option<WidgetFocusInfo>

Reference to the focusable parent that contains this widget.

source

pub fn scope(&self) -> Option<WidgetFocusInfo>

Reference the focus scope parent that contains the widget.

source

pub fn alt_scope(&self) -> Option<WidgetFocusInfo>

Reference the ALT focus scope closest with the current widget.

§Closest Alt Scope
  • If self is already an ALT scope or is in one, moves to a sibling ALT scope, nested ALT scopes are ignored.
  • If self is a normal scope, moves to the first descendant ALT scope, otherwise..
  • Recursively searches for an ALT scope sibling up the scope tree.
source

pub fn in_alt_scope(&self) -> bool

Widget is in a ALT scope or is an ALT scope.

source

pub fn on_focus_scope_move<'f>( &self, last_focused: impl FnOnce(WidgetId) -> Option<&'f WidgetPath>, is_tab_cycle_reentry: bool, reverse: bool, ) -> Option<WidgetFocusInfo>

Widget the focus needs to move to when self gets focused.

§Input
  • last_focused: A function that returns the last focused widget within a focus scope identified by WidgetId.
  • is_tab_cycle_reentry: If the focus returned to self immediately after leaving because the parent scope is TabNav::Cycle.
  • reverse: If the focus reversed into self.
§Returns

Returns the different widget the focus must move to after focusing in self that is a focus scope.

If self is not a FocusScope always returns None.

source

pub fn descendants(&self) -> FocusTreeIter<TreeIter>

Iterator over the focusable widgets contained by this widget.

source

pub fn self_and_descendants(&self) -> FocusTreeIter<TreeIter>

Iterator over self and the focusable widgets contained by it.

source

pub fn has_tab_descendant(&self) -> bool

If the focusable has any focusable descendant that is not TabIndex::SKIP

source

pub fn first_tab_descendant(&self) -> Option<WidgetFocusInfo>

First descendant considering TAB index.

source

pub fn last_tab_descendant(&self) -> Option<WidgetFocusInfo>

Last descendant considering TAB index.

source

pub fn next_focusables(&self) -> FocusTreeIter<TreeIter>

Iterator over all focusable widgets in the same scope after this widget.

source

pub fn next_focusable(&self) -> Option<WidgetFocusInfo>

Next focusable in the same scope after this widget.

source

pub fn next_tab_focusable(&self, skip_self: bool) -> Option<WidgetFocusInfo>

Next focusable in the same scope after this widget respecting the TAB index.

If self is set to TabIndex::SKIP returns the next non-skip focusable in the same scope after this widget.

If skip_self is true, does not include widgets inside self.

source

pub fn prev_focusables(&self) -> FocusTreeIter<RevTreeIter>

Iterator over all focusable widgets in the same scope before this widget in reverse.

source

pub fn prev_focusable(&self) -> Option<WidgetFocusInfo>

Previous focusable in the same scope before this widget.

source

pub fn prev_tab_focusable(&self, skip_self: bool) -> Option<WidgetFocusInfo>

Previous focusable in the same scope after this widget respecting the TAB index.

If self is set to TabIndex::SKIP returns the previous non-skip focusable in the same scope before this widget.

If skip_self is true, does not include widgets inside self.

source

pub fn next_tab(&self, skip_self: bool) -> Option<WidgetFocusInfo>

Widget to focus when pressing TAB from this widget.

Set skip_self to not enter self, that is, the focus goes to the next sibling or next sibling descendant.

Returns None if the focus does not move to another widget.

source

pub fn prev_tab(&self, skip_self: bool) -> Option<WidgetFocusInfo>

Widget to focus when pressing SHIFT+TAB from this widget.

Set skip_self to not enter self, that is, the focus goes to the previous sibling or previous sibling descendant.

Returns None if the focus does not move to another widget.

source

pub fn nearest( &self, origin: PxPoint, max_radius: Px, ) -> Option<WidgetFocusInfo>

Find the focusable descendant with center point nearest of origin within the max_radius.

source

pub fn nearest_filtered( &self, origin: PxPoint, max_radius: Px, filter: impl FnMut(WidgetFocusInfo) -> bool, ) -> Option<WidgetFocusInfo>

Find the descendant with center point nearest of origin within the max_radius and approved by the filter closure.

source

pub fn nearest_bounded_filtered( &self, origin: PxPoint, max_radius: Px, bounds: PxRect, filter: impl FnMut(WidgetFocusInfo) -> bool, ) -> Option<WidgetFocusInfo>

Find the descendant with center point nearest of origin within the max_radius and inside bounds; and approved by the filter closure.

source

pub fn nearest_oriented( &self, origin: PxPoint, max_distance: Px, orientation: Orientation2D, ) -> Option<WidgetFocusInfo>

Find the focusable descendant with center point nearest of origin within the max_distance and with orientation to origin.

source

pub fn nearest_oriented_filtered( &self, origin: PxPoint, max_distance: Px, orientation: Orientation2D, filter: impl FnMut(WidgetFocusInfo) -> bool, ) -> Option<WidgetFocusInfo>

Find the focusable descendant with center point nearest of origin within the max_distance and with orientation to origin that passes the filter.

source

pub fn focusable_up(&self) -> Option<WidgetFocusInfo>

Closest focusable in the same scope above this widget.

source

pub fn focusable_down(&self) -> Option<WidgetFocusInfo>

Closest focusable in the same scope below this widget.

source

pub fn focusable_left(&self) -> Option<WidgetFocusInfo>

Closest focusable in the same scope to the left of this widget.

source

pub fn focusable_right(&self) -> Option<WidgetFocusInfo>

Closest focusable in the same scope to the right of this widget.

source

pub fn next_up(&self) -> Option<WidgetFocusInfo>

Widget to focus when pressing the arrow up key from this widget.

source

pub fn next_right(&self) -> Option<WidgetFocusInfo>

Widget to focus when pressing the arrow right key from this widget.

source

pub fn next_down(&self) -> Option<WidgetFocusInfo>

Widget to focus when pressing the arrow down key from this widget.

source

pub fn next_left(&self) -> Option<WidgetFocusInfo>

Widget to focus when pressing the arrow left key from this widget.

source

pub fn enabled_nav(&self) -> FocusNavAction

Focus navigation actions that can move the focus away from this item.

Trait Implementations§

source§

impl Clone for WidgetFocusInfo

source§

fn clone(&self) -> WidgetFocusInfo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for WidgetFocusInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for WidgetFocusInfo

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for WidgetFocusInfo

source§

fn eq(&self, other: &WidgetFocusInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for WidgetFocusInfo

source§

impl StructuralPartialEq for WidgetFocusInfo

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AnyVarValue for T
where T: VarValue,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Access to dyn Any methods.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Access to mut dyn Any methods.
source§

fn clone_boxed(&self) -> Box<dyn AnyVarValue>

Clone the value.
source§

fn clone_boxed_var(&self) -> Box<dyn AnyVar>

Clone the value into a new boxed LocalVar<Self>.
source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Access to Box<dyn Any> methods.
source§

fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool

Gets if self equals other.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> IntoVar<T> for T
where T: VarValue,

source§

type Var = LocalVar<T>

Variable type that will wrap the T value. Read more
source§

fn into_var(self) -> <T as IntoVar<T>>::Var

Converts the source value into a var.
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> IntoValue<T> for T
where T: VarValue,

source§

impl<T> StateValue for T
where T: Any + Send + Sync,

source§

impl<T> VarValue for T
where T: Debug + Clone + PartialEq + Any + Send + Sync,