Struct zng_ext_input::focus::WidgetFocusInfo
source · 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
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.
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 toself
immediately 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 Hash for WidgetFocusInfo
impl Hash for WidgetFocusInfo
source§impl PartialEq for WidgetFocusInfo
impl PartialEq for WidgetFocusInfo
impl Eq 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 Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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
key
and return true
if they are equal.§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