1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Improve egui_extras::Table layout (#4755)

Mostly a refactor, but some minor fixes to how it works.

Mostly preparing for a few bigger changes.
This commit is contained in:
Emil Ernerfeldt
2024-07-02 20:57:46 +02:00
committed by GitHub
parent f0e2bd8b00
commit 753412193c
7 changed files with 88 additions and 75 deletions

View File

@@ -107,12 +107,12 @@ impl Default for Tests {
fn default() -> Self {
Self::from_demos(vec![
Box::<super::tests::CursorTest>::default(),
Box::<super::tests::GridTest>::default(),
Box::<super::tests::IdTest>::default(),
Box::<super::tests::InputEventHistory>::default(),
Box::<super::tests::InputTest>::default(),
Box::<super::tests::LayoutTest>::default(),
Box::<super::tests::ManualLayoutTest>::default(),
Box::<super::tests::TableTest>::default(),
Box::<super::tests::WindowResizeTest>::default(),
])
}

View File

@@ -1,5 +1,5 @@
#[derive(PartialEq)]
pub struct TableTest {
pub struct GridTest {
num_cols: usize,
num_rows: usize,
min_col_width: f32,
@@ -7,7 +7,7 @@ pub struct TableTest {
text_length: usize,
}
impl Default for TableTest {
impl Default for GridTest {
fn default() -> Self {
Self {
num_cols: 4,
@@ -19,9 +19,9 @@ impl Default for TableTest {
}
}
impl crate::Demo for TableTest {
impl crate::Demo for GridTest {
fn name(&self) -> &'static str {
"Table Test"
"Grid Test"
}
fn show(&mut self, ctx: &egui::Context, open: &mut bool) {
@@ -32,7 +32,7 @@ impl crate::Demo for TableTest {
}
}
impl crate::View for TableTest {
impl crate::View for GridTest {
fn ui(&mut self, ui: &mut egui::Ui) {
ui.add(
egui::Slider::new(&mut self.min_col_width, 0.0..=400.0).text("Minimum column width"),

View File

@@ -1,17 +1,17 @@
mod cursor_test;
mod grid_test;
mod id_test;
mod input_event_history;
mod input_test;
mod layout_test;
mod manual_layout_test;
mod table_test;
mod window_resize_test;
pub use cursor_test::CursorTest;
pub use grid_test::GridTest;
pub use id_test::IdTest;
pub use input_event_history::InputEventHistory;
pub use input_test::InputTest;
pub use layout_test::LayoutTest;
pub use manual_layout_test::ManualLayoutTest;
pub use table_test::TableTest;
pub use window_resize_test::WindowResizeTest;