Add Layer widget

This commit is contained in:
Joscha 2023-02-17 21:06:12 +01:00
parent 72b44fb3fc
commit 7c3277a822
3 changed files with 76 additions and 1 deletions

View file

@ -1,6 +1,6 @@
use async_trait::async_trait;
use crate::widgets::{Background, Border, Float, Padding};
use crate::widgets::{Background, Border, Float, Padding, Layer};
use crate::{Frame, Size};
// TODO Feature-gate these traits
@ -41,6 +41,14 @@ pub trait WidgetExt: Sized {
Float::new(self)
}
fn below<W>(self, top: W) -> Layer<Self, W> {
Layer::new(self, top)
}
fn above<W>(self, bottom: W) -> Layer<W, Self> {
Layer::new(bottom, self)
}
fn padding(self) -> Padding<Self> {
Padding::new(self)
}