pub use ruler::Ruler;
pub use sweeper::Sweeper;
pub use text::Text;
pub use uv::Uv;
pub use margin::Margin;
pub use centered::Centered;
pub use stacked::Stacked;
pub use buttons::Buttons;
pub use shrink_wrap::ShrinkWrap;
pub use backdrop::Backdrop;
use crate::style::{Colour, Style};
use crate::widgets::BoundingBox;
pub mod sweeper;
pub mod ruler;
pub mod text;
pub mod uv;
pub mod margin;
pub mod dummy;
pub mod centered;
pub mod stacked;
pub mod buttons;
pub mod shrink_wrap;
pub mod backdrop;
impl<T: BoundingBox> From<T> for Centered<T> {
fn from(value: T) -> Self {
Self::new(value)
}
}
impl<T: BoundingBox> From<T> for Margin<T> {
fn from(value: T) -> Self {
Self::new(value)
}
}
pub trait WithLayout: Sized {
fn with_margin(self, margin: isize) -> Margin<Self> {
Margin::new(self).margin(margin)
}
fn with_shrink(self, shrink: usize) -> ShrinkWrap<Self> { ShrinkWrap::new(self).shrink(shrink) }
fn use_backdrop(&self, bg_colour: Colour) -> Backdrop<Self> {
Backdrop::new(self).with_style(Style::new().bg(bg_colour))
}
fn centered(self) -> Centered<Self> {
Centered::new(self)
}
fn on_top_of<T>(self, other: T) -> Stacked<Self, T> {
Stacked::new(self, other)
}
}
impl<T: BoundingBox> WithLayout for T {}