Struct zng::focus::FocusInfoBuilder
source · 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) -> FocusInfoBuilder<'a>
pub fn new(builder: &'a mut WidgetInfoBuilder) -> FocusInfoBuilder<'a>
New the builder.
sourcepub fn focusable(&mut self, is_focusable: bool) -> &mut FocusInfoBuilder<'a>
pub fn focusable(&mut self, is_focusable: bool) -> &mut FocusInfoBuilder<'a>
If the widget is definitely focusable or not.
sourcepub fn focusable_passive(
&mut self,
is_focusable: bool,
) -> &mut FocusInfoBuilder<'a>
pub fn focusable_passive( &mut self, is_focusable: bool, ) -> &mut FocusInfoBuilder<'a>
Sets focusable
, only if it was not already set.
sourcepub fn scope(&mut self, is_focus_scope: bool) -> &mut FocusInfoBuilder<'a>
pub fn scope(&mut self, is_focus_scope: bool) -> &mut FocusInfoBuilder<'a>
If the widget is definitely a focus scope or not.
sourcepub fn alt_scope(
&mut self,
is_alt_focus_scope: bool,
) -> &mut FocusInfoBuilder<'a>
pub fn alt_scope( &mut self, is_alt_focus_scope: bool, ) -> &mut FocusInfoBuilder<'a>
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 FocusInfoBuilder<'a>
pub fn on_focus( &mut self, as_focus_scope_on_focus: FocusScopeOnFocus, ) -> &mut FocusInfoBuilder<'a>
When the widget is a focus scope, its behavior on receiving direct focus.
sourcepub fn tab_index(&mut self, tab_index: TabIndex) -> &mut FocusInfoBuilder<'a>
pub fn tab_index(&mut self, tab_index: TabIndex) -> &mut FocusInfoBuilder<'a>
Widget TAB index.
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 FocusInfoBuilder<'a>
pub fn skip_directional(&mut self, skip: bool) -> &mut FocusInfoBuilder<'a>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for 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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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