pub struct StripBuilder<'a> { /* private fields */ }
Expand description
Builder for creating a new Strip
.
This can be used to do dynamic layouts.
In contrast to normal egui behavior, strip cells do not grow with its children!
First use Self::size
and Self::sizes
to allocate space for the rows or columns will follow.
Then build the strip with Self::horizontal
/Self::vertical
, and add ‘cells’
to it using Strip::cell
. The number of cells MUST match the number of pre-allocated sizes.
§Example
use egui_extras::{StripBuilder, Size};
StripBuilder::new(ui)
.size(Size::remainder().at_least(100.0)) // top cell
.size(Size::exact(40.0)) // bottom cell
.vertical(|mut strip| {
// Add the top 'cell'
strip.cell(|ui| {
ui.label("Fixed");
});
// We add a nested strip in the bottom cell:
strip.strip(|builder| {
builder.sizes(Size::remainder(), 2).horizontal(|mut strip| {
strip.cell(|ui| {
ui.label("Top Left");
});
strip.cell(|ui| {
ui.label("Top Right");
});
});
});
});
Implementations§
source§impl<'a> StripBuilder<'a>
impl<'a> StripBuilder<'a>
sourcepub fn clip(self, clip: bool) -> Self
pub fn clip(self, clip: bool) -> Self
Should we clip the contents of each cell? Default: false
.
sourcepub fn cell_layout(self, cell_layout: Layout) -> Self
pub fn cell_layout(self, cell_layout: Layout) -> Self
What layout should we use for the individual cells?
sourcepub fn sense(self, sense: Sense) -> Self
pub fn sense(self, sense: Sense) -> Self
What should strip cells sense for? Default: egui::Sense::hover()
.
sourcepub fn sizes(self, size: Size, count: usize) -> Self
pub fn sizes(self, size: Size, count: usize) -> Self
Allocate space for several columns/rows at once.
sourcepub fn horizontal<F>(self, strip: F) -> Response
pub fn horizontal<F>(self, strip: F) -> Response
Build horizontal strip: Cells are positions from left to right. Takes the available horizontal width, so there can’t be anything right of the strip or the container will grow slowly!
Returns a egui::Response
for hover events.
sourcepub fn vertical<F>(self, strip: F) -> Response
pub fn vertical<F>(self, strip: F) -> Response
Build vertical strip: Cells are positions from top to bottom. Takes the full available vertical height, so there can’t be anything below of the strip or the container will grow slowly!
Returns a egui::Response
for hover events.
Auto Trait Implementations§
impl<'a> Freeze for StripBuilder<'a>
impl<'a> !RefUnwindSafe for StripBuilder<'a>
impl<'a> Send for StripBuilder<'a>
impl<'a> Sync for StripBuilder<'a>
impl<'a> Unpin for StripBuilder<'a>
impl<'a> !UnwindSafe for StripBuilder<'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
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