Add Empty widget

This commit is contained in:
Joscha 2024-03-03 23:52:12 +01:00
parent ba68e34d0d
commit 1000de5bcf
3 changed files with 27 additions and 0 deletions

View file

@ -5,3 +5,4 @@ mod rect;
mod vec2;
mod view;
mod widget;
pub mod widgets;

View file

@ -0,0 +1,3 @@
pub use empty::Empty;
mod empty;

View file

@ -0,0 +1,23 @@
use crate::{Vec2, View, Widget};
pub struct Empty {}
impl Empty {
pub fn new() -> Self {
Self {}
}
}
impl Default for Empty {
fn default() -> Self {
Self::new()
}
}
impl<C> Widget<C> for Empty {
fn size(&self, _max_width: Option<i32>, _max_height: Option<i32>) -> Vec2 {
Vec2::ZERO
}
fn draw(self, _view: &mut View<'_, C>) {}
}