pub struct FocusInfoBuilder<'a>(/* private fields */);
Expand description
Builder for FocusInfo
accessible in a WidgetInfoBuilder
.
There are multiple focusable metadata that can be set on a widget. These rules define how the focusable state of a widget is derived from the focusable metadata.
§Rules
The widget is not focusable nor a focus scope if it set focusable
to false
.
The widget is a focus scope if it set scope
to true
or if it set tab_nav
or
directional_nav
and did not set scope
to false
.
The widget is focusable if it set focusable
to true
or if it set the tab_index
.
The widget is a focus scope if it sets nested_window
, but the focus will always move inside
the nested window.
The widget is not focusable if it did not set any of the members mentioned.
§Tab Index
If the tab_index
was not set but the widget is focusable or a focus scope, the TabIndex::AUTO
is used for the widget.
§Skip Directional
If the skip_directional
was not set but the widget is focusable or a focus scope, it is
set to false
for the widget.
§Focus Scope
If the widget is a focus scope, it is configured using alt_scope
and on_focus
.
If the widget is not a scope these members are ignored.
§Tab Navigation
If tab_nav
is not set but the widget is a focus scope, TabNav::Continue
is used.
§Directional Navigation
If directional_nav
is not set but the widget is a focus scope, DirectionalNav::Continue
is used.
Implementations§
source§impl<'a> FocusInfoBuilder<'a>
impl<'a> FocusInfoBuilder<'a>
sourcepub fn new(builder: &'a mut WidgetInfoBuilder) -> Self
pub fn new(builder: &'a mut WidgetInfoBuilder) -> Self
New the builder.
sourcepub fn focusable(&mut self, is_focusable: bool) -> &mut Self
pub fn focusable(&mut self, is_focusable: bool) -> &mut Self
If the widget is definitely focusable or not.
sourcepub fn focusable_passive(&mut self, is_focusable: bool) -> &mut Self
pub fn focusable_passive(&mut self, is_focusable: bool) -> &mut Self
Sets focusable
, only if it was not already set.
sourcepub fn scope(&mut self, is_focus_scope: bool) -> &mut Self
pub fn scope(&mut self, is_focus_scope: bool) -> &mut Self
If the widget is definitely a focus scope or not.
sourcepub fn alt_scope(&mut self, is_alt_focus_scope: bool) -> &mut Self
pub fn alt_scope(&mut self, is_alt_focus_scope: bool) -> &mut Self
If the widget is definitely an ALT focus scope or not.
If true
this also sets TabIndex::SKIP
, skip_directional_nav
, TabNav::Cycle
and DirectionalNav::Cycle
as default.
sourcepub fn on_focus(
&mut self,
as_focus_scope_on_focus: FocusScopeOnFocus,
) -> &mut Self
pub fn on_focus( &mut self, as_focus_scope_on_focus: FocusScopeOnFocus, ) -> &mut Self
When the widget is a focus scope, its behavior on receiving direct focus.
TAB navigation within this widget, if set turns the widget into a focus scope.
Directional navigation within this widget, if set turns the widget into a focus scope.
sourcepub fn skip_directional(&mut self, skip: bool) -> &mut Self
pub fn skip_directional(&mut self, skip: bool) -> &mut Self
If directional navigation skips over this widget.
Auto Trait Implementations§
impl<'a> Freeze for FocusInfoBuilder<'a>
impl<'a> !RefUnwindSafe for FocusInfoBuilder<'a>
impl<'a> Send for FocusInfoBuilder<'a>
impl<'a> Sync for FocusInfoBuilder<'a>
impl<'a> Unpin for FocusInfoBuilder<'a>
impl<'a> !UnwindSafe for FocusInfoBuilder<'a>
Blanket Implementations§
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
§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