mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 23:00:04 -04:00
add sourcecode links, document slow growing
This commit is contained in:
@@ -32,6 +32,7 @@ impl super::View for GridDemo {
|
|||||||
relative: 0.5,
|
relative: 0.5,
|
||||||
minimum: 60.0,
|
minimum: 60.0,
|
||||||
})
|
})
|
||||||
|
.size(Size::Absolute(14.0))
|
||||||
.vertical(|mut grid| {
|
.vertical(|mut grid| {
|
||||||
grid.cell(|ui| {
|
grid.cell(|ui| {
|
||||||
ui.painter()
|
ui.painter()
|
||||||
@@ -99,6 +100,11 @@ impl super::View for GridDemo {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
grid.cell(|ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.add(crate::__egui_github_link_file!());
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use egui::{Label, RichText};
|
use egui::{Label, RichText};
|
||||||
use egui_extras::{Padding, Size, TableBuilder};
|
use egui_extras::{GridBuilder, Padding, Size, TableBuilder};
|
||||||
|
|
||||||
/// Shows off a table with dynamic layout
|
/// Shows off a table with dynamic layout
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||||
@@ -29,6 +29,12 @@ impl super::View for TableDemo {
|
|||||||
fn ui(&mut self, ui: &mut egui::Ui) {
|
fn ui(&mut self, ui: &mut egui::Ui) {
|
||||||
ui.checkbox(&mut self.virtual_scrool, "Virtual scroll demo");
|
ui.checkbox(&mut self.virtual_scrool, "Virtual scroll demo");
|
||||||
|
|
||||||
|
// The table is inside a grid as its container would otherwise grow slowly as it takes all available height
|
||||||
|
GridBuilder::new(ui, Padding::new(0.0, 0.0))
|
||||||
|
.size(Size::Remainder)
|
||||||
|
.size(Size::Absolute(14.0))
|
||||||
|
.vertical(|mut grid| {
|
||||||
|
grid.cell(|ui| {
|
||||||
// TODO: Fix table as a padding smaller than 16 grows the window
|
// TODO: Fix table as a padding smaller than 16 grows the window
|
||||||
TableBuilder::new(ui, Padding::new(3.0, 16.0))
|
TableBuilder::new(ui, Padding::new(3.0, 16.0))
|
||||||
.striped(true)
|
.striped(true)
|
||||||
@@ -88,5 +94,12 @@ impl super::View for TableDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
grid.cell(|ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.add(crate::__egui_github_link_file!());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ impl<'a> GridBuilder<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Build horizontal grid
|
/// Build horizontal grid
|
||||||
|
/// Takes the available horizontal width, so there can't be anything right of the grid or the container will grow slowly!
|
||||||
pub fn horizontal<F>(self, grid: F)
|
pub fn horizontal<F>(self, grid: F)
|
||||||
where
|
where
|
||||||
F: for<'b> FnOnce(Grid<'a, 'b>),
|
F: for<'b> FnOnce(Grid<'a, 'b>),
|
||||||
@@ -62,6 +63,7 @@ impl<'a> GridBuilder<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Build vertical grid
|
/// Build vertical grid
|
||||||
|
/// Takes the full available vertical height, so there can't be anything below of the grid or the container will grow slowly!
|
||||||
pub fn vertical<F>(self, grid: F)
|
pub fn vertical<F>(self, grid: F)
|
||||||
where
|
where
|
||||||
F: for<'b> FnOnce(Grid<'a, 'b>),
|
F: for<'b> FnOnce(Grid<'a, 'b>),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/// Table view with (optional) fixed header and scrolling body.
|
/// Table view with (optional) fixed header and scrolling body.
|
||||||
/// Cell widths are precalculated with given size hints so we can have tables like this:
|
/// Cell widths are precalculated with given size hints so we can have tables like this:
|
||||||
/// | fixed size | all available space/minimum | 30% of available width | fixed size |
|
/// | fixed size | all available space/minimum | 30% of available width | fixed size |
|
||||||
|
/// Takes all available height, so if you want something below the table, put it in a grid.
|
||||||
use crate::{
|
use crate::{
|
||||||
layout::{CellSize, LineDirection},
|
layout::{CellSize, LineDirection},
|
||||||
sizing::Sizing,
|
sizing::Sizing,
|
||||||
|
|||||||
Reference in New Issue
Block a user