pub struct FocusBuilder { /* private fields */ }Expand description
Builder for the Focus.
Implementations§
source§impl FocusBuilder
impl FocusBuilder
pub fn new(last: Option<Focus>) -> FocusBuilder
pub fn enable_log(self) -> Self
sourcepub fn container(&mut self, container: &dyn FocusContainer) -> &mut Self
pub fn container(&mut self, container: &dyn FocusContainer) -> &mut Self
Add a container widget.
Adds start+end and calls container.build()
sourcepub fn widget(&mut self, widget: &dyn HasFocus) -> &mut Self
pub fn widget(&mut self, widget: &dyn HasFocus) -> &mut Self
Add a widget.
The widget is added to all open containers.
sourcepub fn add_widget(
&mut self,
focus: FocusFlag,
area: Rect,
z_areas: &[ZRect],
navigable: Navigation,
)
pub fn add_widget( &mut self, focus: FocusFlag, area: Rect, z_areas: &[ZRect], navigable: Navigation, )
Add a widget by setting all the attributes. The widget is added to all open containers.
sourcepub fn start(
&mut self,
container_flag: Option<ContainerFlag>,
area: Rect,
) -> Option<ContainerFlag>
pub fn start( &mut self, container_flag: Option<ContainerFlag>, area: Rect, ) -> Option<ContainerFlag>
sourcepub fn end(&mut self, container_flag: Option<ContainerFlag>)
pub fn end(&mut self, container_flag: Option<ContainerFlag>)
Manually end a container widget.
Use of container is preferred.
sourcepub fn build(self) -> Focus
pub fn build(self) -> Focus
Build the final focus.
If old is given, all widgets/containers no longer in the focus list are cleared().
sourcepub fn for_container(container: &dyn FocusContainer) -> Focus
pub fn for_container(container: &dyn FocusContainer) -> Focus
Shortcut for building the focus for a container that implements HasFocus.
This creates a fresh Focus.
See Use rebuild if you want to ensure that widgets that are no longer in the widget structure have their focus flag reset properly. If you don’t have some logic to conditionally add widgets to the focus, this function is probably fine.
sourcepub fn rebuild(container: &dyn FocusContainer, old: Option<Focus>) -> Focus
pub fn rebuild(container: &dyn FocusContainer, old: Option<Focus>) -> Focus
Shortcut function for building the focus for a container that implements HasFocus
This takes the old Focus and reuses most of its allocations. It also ensures that any widgets no longer in the widget structure have their focus-flags reset.
Trait Implementations§
source§impl Debug for FocusBuilder
impl Debug for FocusBuilder
source§impl Default for FocusBuilder
impl Default for FocusBuilder
source§fn default() -> FocusBuilder
fn default() -> FocusBuilder
Auto Trait Implementations§
impl !Freeze for FocusBuilder
impl !RefUnwindSafe for FocusBuilder
impl !Send for FocusBuilder
impl !Sync for FocusBuilder
impl Unpin for FocusBuilder
impl !UnwindSafe for FocusBuilder
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
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