Struct egui::Grid[][src]

pub struct Grid { /* fields omitted */ }

A simple grid layout.

The cells are always layed 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

impl Grid[src]

pub fn new(id_source: impl Hash) -> Self[src]

Create a new Grid with a locally unique identifier.

pub fn striped(self, striped: bool) -> Self[src]

If true, add a subtle background color to every other row.

This can make a table easier to read. Default: false.

pub fn min_col_width(self, min_col_width: f32) -> Self[src]

Set minimum width of each column. Default: crate::style::Spacing::interact_size.x.

pub fn min_row_height(self, min_row_height: f32) -> Self[src]

Set minimum height of each row. Default: crate::style::Spacing::interact_size.y.

pub fn max_col_width(self, max_col_width: f32) -> Self[src]

Set soft maximum width (wrapping width) of each column.

pub fn spacing(self, spacing: impl Into<Vec2>) -> Self[src]

Set spacing between columns/rows. Default: crate::style::Spacing::item_spacing.

impl Grid[src]

pub fn show<R>(
    self,
    ui: &mut Ui,
    add_contents: impl FnOnce(&mut Ui) -> R
) -> InnerResponse<R>
[src]

Auto Trait Implementations

impl RefUnwindSafe for Grid

impl Send for Grid

impl Sync for Grid

impl Unpin for Grid

impl UnwindSafe for Grid

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.