From 2ec346e7f5a1c15753958b327dff73cb5b08c586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20R=C3=B6ssler?= Date: Mon, 28 Mar 2022 17:21:26 +0200 Subject: [PATCH] rename Layout to StripLayout --- egui_extras/src/layout.rs | 12 ++++++------ egui_extras/src/lib.rs | 2 +- egui_extras/src/strip.rs | 8 ++++---- egui_extras/src/table.rs | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/egui_extras/src/layout.rs b/egui_extras/src/layout.rs index 8e9d1cb6..c95bd11c 100644 --- a/egui_extras/src/layout.rs +++ b/egui_extras/src/layout.rs @@ -12,10 +12,10 @@ pub(crate) enum CellSize { /// /// In a strip there's only one line which goes in the direction of the strip: /// -/// In a horizontal strip, a `[Layout]` with horizontal `[CellDirection]` is used. -/// Its cells go from left to right inside this `[Layout]`. +/// In a horizontal strip, a `[StripLayout]` with horizontal `[CellDirection]` is used. +/// Its cells go from left to right inside this `[StripLayout]`. /// -/// In a table there's a `[Layout]` for each table row with a horizonal `[CellDirection]`. +/// In a table there's a `[StripLayout]` for each table row with a horizonal `[CellDirection]`. /// Its cells go from left to right. And the lines go from top to bottom. pub(crate) enum CellDirection { /// Cells go from left to right @@ -24,8 +24,8 @@ pub(crate) enum CellDirection { Vertical, } -/// Positions cells in `[CellDirection]` and starts a new line on `[Layout::end_line]` -pub struct Layout<'l> { +/// Positions cells in `[CellDirection]` and starts a new line on `[StripLayout::end_line]` +pub struct StripLayout<'l> { ui: &'l mut Ui, direction: CellDirection, rect: Rect, @@ -33,7 +33,7 @@ pub struct Layout<'l> { max: Pos2, } -impl<'l> Layout<'l> { +impl<'l> StripLayout<'l> { pub(crate) fn new(ui: &'l mut Ui, direction: CellDirection) -> Self { let rect = ui.available_rect_before_wrap(); let pos = rect.left_top(); diff --git a/egui_extras/src/lib.rs b/egui_extras/src/lib.rs index 08060265..014b75dd 100644 --- a/egui_extras/src/lib.rs +++ b/egui_extras/src/lib.rs @@ -16,7 +16,7 @@ mod table; pub use crate::datepicker::DatePickerButton; pub use crate::image::RetainedImage; -pub(crate) use crate::layout::Layout; +pub(crate) use crate::layout::StripLayout; pub use crate::sizing::Size; pub use crate::strip::*; pub use crate::table::*; diff --git a/egui_extras/src/strip.rs b/egui_extras/src/strip.rs index 6ce0d1d3..b05cb51b 100644 --- a/egui_extras/src/strip.rs +++ b/egui_extras/src/strip.rs @@ -1,5 +1,5 @@ use crate::{ - layout::{CellDirection, CellSize, Layout}, + layout::{CellDirection, CellSize, StripLayout}, sizing::Sizing, Size, }; @@ -74,7 +74,7 @@ impl<'a> StripBuilder<'a> { self.ui.available_rect_before_wrap().width() - self.ui.spacing().item_spacing.x, self.ui.spacing().item_spacing.x, ); - let mut layout = Layout::new(self.ui, CellDirection::Horizontal); + let mut layout = StripLayout::new(self.ui, CellDirection::Horizontal); strip(Strip { layout: &mut layout, direction: CellDirection::Horizontal, @@ -95,7 +95,7 @@ impl<'a> StripBuilder<'a> { self.ui.available_rect_before_wrap().height() - self.ui.spacing().item_spacing.y, self.ui.spacing().item_spacing.y, ); - let mut layout = Layout::new(self.ui, CellDirection::Vertical); + let mut layout = StripLayout::new(self.ui, CellDirection::Vertical); strip(Strip { layout: &mut layout, direction: CellDirection::Vertical, @@ -108,7 +108,7 @@ impl<'a> StripBuilder<'a> { /// A Strip of cells which go in one direction. Each cell has a fixed size. /// In contrast to normal egui behavior, strip cells do *not* grow with its children! pub struct Strip<'a, 'b> { - layout: &'b mut Layout<'a>, + layout: &'b mut StripLayout<'a>, direction: CellDirection, sizes: Vec, } diff --git a/egui_extras/src/table.rs b/egui_extras/src/table.rs index e452ea20..d3706264 100644 --- a/egui_extras/src/table.rs +++ b/egui_extras/src/table.rs @@ -6,7 +6,7 @@ use crate::{ layout::{CellDirection, CellSize}, sizing::Sizing, - Layout, Size, + Size, StripLayout, }; use egui::{Response, Ui}; @@ -108,7 +108,7 @@ impl<'a> TableBuilder<'a> { ); let ui = self.ui; { - let mut layout = Layout::new(ui, CellDirection::Horizontal); + let mut layout = StripLayout::new(ui, CellDirection::Horizontal); { let row = TableRow { layout: &mut layout, @@ -172,7 +172,7 @@ impl<'a> Table<'a> { let end_y = ui.available_rect_before_wrap().bottom(); egui::ScrollArea::new([false, self.scroll]).show(ui, move |ui| { - let layout = Layout::new(ui, CellDirection::Horizontal); + let layout = StripLayout::new(ui, CellDirection::Horizontal); body(TableBody { layout, @@ -189,7 +189,7 @@ impl<'a> Table<'a> { /// The body of a table. /// Is created by calling `body` on a [`Table`] (after adding a header row) or [`TableBuilder`] (without a header row). pub struct TableBody<'a> { - layout: Layout<'a>, + layout: StripLayout<'a>, widths: Vec, striped: bool, row_nr: usize, @@ -273,7 +273,7 @@ impl<'a> Drop for TableBody<'a> { /// The row of a table. /// Is created by [`TableRow`] for each created [`TableBody::row`] or each visible row in rows created by calling [`TableBody::rows`]. pub struct TableRow<'a, 'b> { - layout: &'b mut Layout<'a>, + layout: &'b mut StripLayout<'a>, widths: Vec, striped: bool, height: f32,