pub struct WidgetFocusInfo { /* private fields */ }Expand description
WidgetInfo wrapper that adds focus information for each widget.
Implementations§
Source§impl WidgetFocusInfo
impl WidgetFocusInfo
Sourcepub fn new(
widget_info: WidgetInfo,
focus_disabled_widgets: bool,
focus_hidden_widgets: bool,
) -> Self
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.
Sourcepub fn info(&self) -> &WidgetInfo
pub fn info(&self) -> &WidgetInfo
Full widget info.
Sourcepub fn focus_disabled_widgets(&self) -> bool
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.
If Hidden widgets are focusable in this tree.
See the FOCUS.focus_hidden_widgets config for more details.
Sourcepub fn focus_tree(&self) -> FocusInfoTree
pub fn focus_tree(&self) -> FocusInfoTree
Clone a reference to the FocusInfoTree that owns this widget.
Sourcepub fn is_focusable(&self) -> bool
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.
Sourcepub fn is_alt_scope(&self) -> bool
pub fn is_alt_scope(&self) -> bool
Is ALT focus scope.
Sourcepub fn nested_window(&self) -> Option<WindowId>
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.
Sourcepub fn nested_window_tree(&self) -> Option<FocusInfoTree>
pub fn nested_window_tree(&self) -> Option<FocusInfoTree>
Gets the nested window focus tree, if this widget hosts a nested window.
Sourcepub fn focus_info(&self) -> FocusInfo
pub fn focus_info(&self) -> FocusInfo
Widget focus metadata.
Sourcepub fn focus_info_ignore_blocked(&self) -> FocusInfo
pub fn focus_info_ignore_blocked(&self) -> FocusInfo
Widget focus metadata, all things equal except the widget interactivity is blocked.
Sourcepub fn ancestors(&self) -> impl Iterator<Item = WidgetFocusInfo>
pub fn ancestors(&self) -> impl Iterator<Item = WidgetFocusInfo>
Iterator over focusable parent -> grandparent -> .. -> root.
Sourcepub fn self_and_ancestors(&self) -> impl Iterator<Item = WidgetFocusInfo>
pub fn self_and_ancestors(&self) -> impl Iterator<Item = WidgetFocusInfo>
Iterator over self -> focusable parent -> grandparent -> .. -> root.
Sourcepub fn scopes(&self) -> impl Iterator<Item = WidgetFocusInfo>
pub fn scopes(&self) -> impl Iterator<Item = WidgetFocusInfo>
Iterator over focus scopes parent -> grandparent -> .. -> root.
Sourcepub fn parent(&self) -> Option<WidgetFocusInfo>
pub fn parent(&self) -> Option<WidgetFocusInfo>
Reference to the focusable parent that contains this widget.
Sourcepub fn scope(&self) -> Option<WidgetFocusInfo>
pub fn scope(&self) -> Option<WidgetFocusInfo>
Reference the focus scope parent that contains the widget.
Sourcepub fn alt_scope(&self) -> Option<WidgetFocusInfo>
pub fn alt_scope(&self) -> Option<WidgetFocusInfo>
Reference the ALT focus scope closest with the current widget.
§Closest Alt Scope
- If
selfis already an ALT scope or is in one, moves to a sibling ALT scope, nested ALT scopes are ignored. - If
selfis a normal scope, moves to the first descendant ALT scope, otherwise.. - Recursively searches for an ALT scope sibling up the scope tree.
Sourcepub fn in_alt_scope(&self) -> bool
pub fn in_alt_scope(&self) -> bool
Widget is in a ALT scope or is an ALT scope.
Sourcepub fn on_focus_scope_move<'f>(
&self,
last_focused: impl FnOnce(WidgetId) -> Option<&'f WidgetPath>,
is_tab_cycle_reentry: bool,
reverse: bool,
) -> Option<WidgetFocusInfo>
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 byWidgetId.is_tab_cycle_reentry: If the focus returned toselfimmediately after leaving because the parent scope isTabNav::Cycle.reverse: If the focus reversed intoself.
§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.
Sourcepub fn descendants(&self) -> FocusTreeIter<TreeIter> ⓘ
pub fn descendants(&self) -> FocusTreeIter<TreeIter> ⓘ
Iterator over the focusable widgets contained by this widget.
Sourcepub fn self_and_descendants(&self) -> FocusTreeIter<TreeIter> ⓘ
pub fn self_and_descendants(&self) -> FocusTreeIter<TreeIter> ⓘ
Iterator over self and the focusable widgets contained by it.
Sourcepub fn has_tab_descendant(&self) -> bool
pub fn has_tab_descendant(&self) -> bool
If the focusable has any focusable descendant that is not TabIndex::SKIP
Sourcepub fn first_tab_descendant(&self) -> Option<WidgetFocusInfo>
pub fn first_tab_descendant(&self) -> Option<WidgetFocusInfo>
First descendant considering TAB index.
Sourcepub fn last_tab_descendant(&self) -> Option<WidgetFocusInfo>
pub fn last_tab_descendant(&self) -> Option<WidgetFocusInfo>
Last descendant considering TAB index.
Sourcepub fn next_focusables(&self) -> FocusTreeIter<TreeIter> ⓘ
pub fn next_focusables(&self) -> FocusTreeIter<TreeIter> ⓘ
Iterator over all focusable widgets in the same scope after this widget.
Sourcepub fn next_focusable(&self) -> Option<WidgetFocusInfo>
pub fn next_focusable(&self) -> Option<WidgetFocusInfo>
Next focusable in the same scope after this widget.
Sourcepub fn next_tab_focusable(&self, skip_self: bool) -> Option<WidgetFocusInfo>
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.
Sourcepub fn prev_focusables(&self) -> FocusTreeIter<RevTreeIter> ⓘ
pub fn prev_focusables(&self) -> FocusTreeIter<RevTreeIter> ⓘ
Iterator over all focusable widgets in the same scope before this widget in reverse.
Sourcepub fn prev_focusable(&self) -> Option<WidgetFocusInfo>
pub fn prev_focusable(&self) -> Option<WidgetFocusInfo>
Previous focusable in the same scope before this widget.
Sourcepub fn prev_tab_focusable(&self, skip_self: bool) -> Option<WidgetFocusInfo>
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.
Sourcepub fn next_tab(&self, skip_self: bool) -> Option<WidgetFocusInfo>
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.
Sourcepub fn prev_tab(&self, skip_self: bool) -> Option<WidgetFocusInfo>
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.
Sourcepub fn nearest(
&self,
origin: PxPoint,
max_radius: Px,
) -> Option<WidgetFocusInfo>
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.
Sourcepub fn nearest_filtered(
&self,
origin: PxPoint,
max_radius: Px,
filter: impl FnMut(WidgetFocusInfo) -> bool,
) -> Option<WidgetFocusInfo>
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.
Sourcepub fn nearest_bounded_filtered(
&self,
origin: PxPoint,
max_radius: Px,
bounds: PxRect,
filter: impl FnMut(WidgetFocusInfo) -> bool,
) -> Option<WidgetFocusInfo>
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.
Sourcepub fn nearest_oriented(
&self,
origin: PxPoint,
max_distance: Px,
orientation: Orientation2D,
) -> Option<WidgetFocusInfo>
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.
Sourcepub fn nearest_oriented_filtered(
&self,
origin: PxPoint,
max_distance: Px,
orientation: Orientation2D,
filter: impl FnMut(WidgetFocusInfo) -> bool,
) -> Option<WidgetFocusInfo>
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.
Sourcepub fn focusable_up(&self) -> Option<WidgetFocusInfo>
pub fn focusable_up(&self) -> Option<WidgetFocusInfo>
Closest focusable in the same scope above this widget.
Sourcepub fn focusable_down(&self) -> Option<WidgetFocusInfo>
pub fn focusable_down(&self) -> Option<WidgetFocusInfo>
Closest focusable in the same scope below this widget.
Sourcepub fn focusable_left(&self) -> Option<WidgetFocusInfo>
pub fn focusable_left(&self) -> Option<WidgetFocusInfo>
Closest focusable in the same scope to the left of this widget.
Sourcepub fn focusable_right(&self) -> Option<WidgetFocusInfo>
pub fn focusable_right(&self) -> Option<WidgetFocusInfo>
Closest focusable in the same scope to the right of this widget.
Sourcepub fn next_up(&self) -> Option<WidgetFocusInfo>
pub fn next_up(&self) -> Option<WidgetFocusInfo>
Widget to focus when pressing the arrow up key from this widget.
Sourcepub fn next_right(&self) -> Option<WidgetFocusInfo>
pub fn next_right(&self) -> Option<WidgetFocusInfo>
Widget to focus when pressing the arrow right key from this widget.
Sourcepub fn next_down(&self) -> Option<WidgetFocusInfo>
pub fn next_down(&self) -> Option<WidgetFocusInfo>
Widget to focus when pressing the arrow down key from this widget.
Sourcepub fn next_left(&self) -> Option<WidgetFocusInfo>
pub fn next_left(&self) -> Option<WidgetFocusInfo>
Widget to focus when pressing the arrow left key from this widget.
Focus navigation actions that can move the focus away from this item.
Trait Implementations§
Source§impl Clone for WidgetFocusInfo
impl Clone for WidgetFocusInfo
Source§fn clone(&self) -> WidgetFocusInfo
fn clone(&self) -> WidgetFocusInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WidgetFocusInfo
impl Debug for WidgetFocusInfo
Source§impl From<WidgetFocusInfo> for WidgetInfo
impl From<WidgetFocusInfo> for WidgetInfo
Source§fn from(focus_info: WidgetFocusInfo) -> Self
fn from(focus_info: WidgetFocusInfo) -> Self
Source§impl Hash for WidgetFocusInfo
impl Hash for WidgetFocusInfo
Source§impl IntoVar<WidgetInfo> for WidgetFocusInfo
impl IntoVar<WidgetInfo> for WidgetFocusInfo
fn into_var(self) -> Var<WidgetInfo>
Source§impl PartialEq for WidgetFocusInfo
impl PartialEq for WidgetFocusInfo
impl Eq for WidgetFocusInfo
impl IntoValue<WidgetInfo> for WidgetFocusInfo
impl StructuralPartialEq for WidgetFocusInfo
Auto Trait Implementations§
impl Freeze for WidgetFocusInfo
impl !RefUnwindSafe for WidgetFocusInfo
impl Send for WidgetFocusInfo
impl Sync for WidgetFocusInfo
impl Unpin for WidgetFocusInfo
impl !UnwindSafe for WidgetFocusInfo
Blanket Implementations§
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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