mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
rename Split to Stack
This commit is contained in:
parent
2adf0028c3
commit
e555074bdf
8 changed files with 42 additions and 42 deletions
|
|
@ -711,7 +711,7 @@ impl<E: Engine, T: Widget<Engine = E>> Widget for Pull<E::Unit, T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Split<
|
||||
pub struct Stack<
|
||||
E: Engine,
|
||||
F: Send + Sync + Fn(&mut dyn FnMut(&dyn Widget<Engine = E>)->Usually<()>)->Usually<()>
|
||||
>(pub F, pub Direction, PhantomData<E>);
|
||||
|
|
@ -719,7 +719,7 @@ pub struct Split<
|
|||
impl<
|
||||
E: Engine,
|
||||
F: Send + Sync + Fn(&mut dyn FnMut(&dyn Widget<Engine = E>)->Usually<()>)->Usually<()>
|
||||
> Split<E, F> {
|
||||
> Stack<E, F> {
|
||||
#[inline] pub fn new (direction: Direction, build: F) -> Self {
|
||||
Self(build, direction, Default::default())
|
||||
}
|
||||
|
|
@ -731,7 +731,7 @@ impl<
|
|||
}
|
||||
}
|
||||
|
||||
impl<E: Engine, F> Widget for Split<E, F>
|
||||
impl<E: Engine, F> Widget for Stack<E, F>
|
||||
where
|
||||
F: Send + Sync + Fn(&mut dyn FnMut(&dyn Widget<Engine = E>)->Usually<()>)->Usually<()>
|
||||
{
|
||||
|
|
@ -824,8 +824,8 @@ where
|
|||
($($expr:expr),* $(,)?) => { Layers::new(move|add|{ $(add(&$expr)?;)* Ok(()) }) }
|
||||
}
|
||||
#[macro_export] macro_rules! col {
|
||||
($($expr:expr),* $(,)?) => { Split::down(move|add|{ $(add(&$expr)?;)* Ok(()) }) }
|
||||
($($expr:expr),* $(,)?) => { Stack::down(move|add|{ $(add(&$expr)?;)* Ok(()) }) }
|
||||
}
|
||||
#[macro_export] macro_rules! row {
|
||||
($($expr:expr),* $(,)?) => { Split::right(move|add|{ $(add(&$expr)?;)* Ok(()) }) }
|
||||
($($expr:expr),* $(,)?) => { Stack::right(move|add|{ $(add(&$expr)?;)* Ok(()) }) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,28 +72,28 @@ fn test_outset_align () -> Usually<()> {
|
|||
//Some([0, 0, 4, 4]));
|
||||
//assert_eq!(Align::Center(test).layout(area)?,
|
||||
//Some([3, 3, 4, 4]));
|
||||
//assert_eq!(Align::Center(Split::down(|add|{
|
||||
//assert_eq!(Align::Center(Stack::down(|add|{
|
||||
//add(&test)?;
|
||||
//add(&test)
|
||||
//})).layout(area)?,
|
||||
//Some([3, 1, 4, 8]));
|
||||
//assert_eq!(Align::Center(Split::down(|add|{
|
||||
//assert_eq!(Align::Center(Stack::down(|add|{
|
||||
//add(&Outset::XY(2, 2, test))?;
|
||||
//add(&test)
|
||||
//})).layout(area)?,
|
||||
//Some([2, 0, 6, 10]));
|
||||
//assert_eq!(Align::Center(Split::down(|add|{
|
||||
//assert_eq!(Align::Center(Stack::down(|add|{
|
||||
//add(&Outset::XY(2, 2, test))?;
|
||||
//add(&Inset::XY(2, 2, test))
|
||||
//})).layout(area)?,
|
||||
//Some([2, 1, 6, 8]));
|
||||
//assert_eq!(Split::down(|add|{
|
||||
//assert_eq!(Stack::down(|add|{
|
||||
//add(&Outset::XY(2, 2, test))?;
|
||||
//add(&Inset::XY(2, 2, test))
|
||||
//}).layout(area)?,
|
||||
//Some([0, 0, 6, 8]));
|
||||
//assert_eq!(Split::right(|add|{
|
||||
//add(&Split::down(|add|{
|
||||
//assert_eq!(Stack::right(|add|{
|
||||
//add(&Stack::down(|add|{
|
||||
//add(&Outset::XY(2, 2, test))?;
|
||||
//add(&Inset::XY(2, 2, test))
|
||||
//}))?;
|
||||
|
|
@ -142,34 +142,34 @@ fn test_outset_align () -> Usually<()> {
|
|||
//Some([0, 0, 3, 1]));
|
||||
//assert_eq!(Layers::new(|add|{add(&"1")?;add(&"333")}).layout(area)?,
|
||||
//Some([0, 0, 3, 1]));
|
||||
//assert_eq!(Split::down(|add|{add(&"1")?;add(&"333")}).layout(area)?,
|
||||
//assert_eq!(Stack::down(|add|{add(&"1")?;add(&"333")}).layout(area)?,
|
||||
//Some([0, 0, 3, 2]));
|
||||
//assert_eq!(Split::right(|add|{add(&"1")?;add(&"333")}).layout(area)?,
|
||||
//assert_eq!(Stack::right(|add|{add(&"1")?;add(&"333")}).layout(area)?,
|
||||
//Some([0, 0, 4, 1]));
|
||||
//assert_eq!(Split::down(|add|{
|
||||
//add(&Split::right(|add|{add(&"1")?;add(&"333")}))?;
|
||||
//assert_eq!(Stack::down(|add|{
|
||||
//add(&Stack::right(|add|{add(&"1")?;add(&"333")}))?;
|
||||
//add(&"55555")
|
||||
//}).layout(area)?,
|
||||
//Some([0, 0, 5, 2]));
|
||||
//let area: [u16;4] = [1, 1, 100, 100];
|
||||
//assert_eq!(Outset::X(1, Split::right(|add|{add(&"1")?;add(&"333")})).layout(area)?,
|
||||
//assert_eq!(Outset::X(1, Stack::right(|add|{add(&"1")?;add(&"333")})).layout(area)?,
|
||||
//Some([0, 1, 6, 1]));
|
||||
//assert_eq!(Outset::Y(1, Split::right(|add|{add(&"1")?;add(&"333")})).layout(area)?,
|
||||
//assert_eq!(Outset::Y(1, Stack::right(|add|{add(&"1")?;add(&"333")})).layout(area)?,
|
||||
//Some([1, 0, 4, 3]));
|
||||
//assert_eq!(Outset::XY(1, 1, Split::right(|add|{add(&"1")?;add(&"333")})).layout(area)?,
|
||||
//assert_eq!(Outset::XY(1, 1, Stack::right(|add|{add(&"1")?;add(&"333")})).layout(area)?,
|
||||
//Some([0, 0, 6, 3]));
|
||||
//assert_eq!(Split::down(|add|{
|
||||
//assert_eq!(Stack::down(|add|{
|
||||
//add(&Outset::XY(1, 1, "1"))?;
|
||||
//add(&Outset::XY(1, 1, "333"))
|
||||
//}).layout(area)?,
|
||||
//Some([1, 1, 5, 6]));
|
||||
//let area: [u16;4] = [1, 1, 95, 100];
|
||||
//assert_eq!(Align::Center(Split::down(|add|{
|
||||
//assert_eq!(Align::Center(Stack::down(|add|{
|
||||
//add(&Outset::XY(1, 1, "1"))?;
|
||||
//add(&Outset::XY(1, 1, "333"))
|
||||
//})).layout(area)?,
|
||||
//Some([46, 48, 5, 6]));
|
||||
//assert_eq!(Align::Center(Split::down(|add|{
|
||||
//assert_eq!(Align::Center(Stack::down(|add|{
|
||||
//add(&Layers::new(|add|{
|
||||
////add(&Outset::XY(1, 1, Background(Color::Rgb(0,128,0))))?;
|
||||
//add(&Outset::XY(1, 1, "1"))?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue