Add Empty widget
This commit is contained in:
parent
ba68e34d0d
commit
1000de5bcf
3 changed files with 27 additions and 0 deletions
|
|
@ -5,3 +5,4 @@ mod rect;
|
||||||
mod vec2;
|
mod vec2;
|
||||||
mod view;
|
mod view;
|
||||||
mod widget;
|
mod widget;
|
||||||
|
pub mod widgets;
|
||||||
|
|
|
||||||
3
showbits-common/src/widgets.rs
Normal file
3
showbits-common/src/widgets.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
pub use empty::Empty;
|
||||||
|
|
||||||
|
mod empty;
|
||||||
23
showbits-common/src/widgets/empty.rs
Normal file
23
showbits-common/src/widgets/empty.rs
Normal 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>) {}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue