pub struct Grid { /* private fields */ }
Expand description
A simple grid layout.
The cells are always laid out left to right, top-down. The contents of each cell will be aligned to the left and center.
If you want to add multiple widgets to a cell you need to group them with
Ui::horizontal
, Ui::vertical
etc.
egui::Grid::new("some_unique_id").show(ui, |ui| {
ui.label("First row, first column");
ui.label("First row, second column");
ui.end_row();
ui.label("Second row, first column");
ui.label("Second row, second column");
ui.label("Second row, third column");
ui.end_row();
ui.horizontal(|ui| { ui.label("Same"); ui.label("cell"); });
ui.label("Third row, second column");
ui.end_row();
});
Implementations§
Source§impl Grid
impl Grid
Sourcepub fn with_row_color<F>(self, color_picker: F) -> Grid
pub fn with_row_color<F>(self, color_picker: F) -> Grid
Setting this will allow for dynamic coloring of rows of the grid object
Sourcepub fn num_columns(self, num_columns: usize) -> Grid
pub fn num_columns(self, num_columns: usize) -> Grid
Setting this will allow the last column to expand to take up the rest of the space of the parent Ui
.
Sourcepub fn striped(self, striped: bool) -> Grid
pub fn striped(self, striped: bool) -> Grid
If true
, add a subtle background color to every other row.
This can make a table easier to read.
Default is whatever is in crate::Visuals::striped
.
Sourcepub fn min_col_width(self, min_col_width: f32) -> Grid
pub fn min_col_width(self, min_col_width: f32) -> Grid
Set minimum width of each column.
Default: crate::style::Spacing::interact_size
.x
.
Sourcepub fn min_row_height(self, min_row_height: f32) -> Grid
pub fn min_row_height(self, min_row_height: f32) -> Grid
Set minimum height of each row.
Default: crate::style::Spacing::interact_size
.y
.
Sourcepub fn max_col_width(self, max_col_width: f32) -> Grid
pub fn max_col_width(self, max_col_width: f32) -> Grid
Set soft maximum width (wrapping width) of each column.
Auto Trait Implementations§
impl Freeze for Grid
impl !RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl !UnwindSafe for Grid
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.