mistakes were fixed and sins were committed
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
use crate::layout::{Painter, Size, SizeCtx, StaticWidgetId, Ui, WidgetId, WidgetIdFn};
|
||||
use crate::layout::{Len, Painter, SizeCtx, StaticWidgetId, Ui, WidgetId, WidgetIdFn};
|
||||
|
||||
use std::{any::Any, marker::PhantomData};
|
||||
|
||||
pub trait Widget: Any {
|
||||
fn draw(&mut self, painter: &mut Painter);
|
||||
fn desired_size(&mut self, _: &mut SizeCtx) -> Size {
|
||||
Size::default()
|
||||
}
|
||||
fn desired_width(&mut self, ctx: &mut SizeCtx) -> Len;
|
||||
fn desired_height(&mut self, ctx: &mut SizeCtx) -> Len;
|
||||
}
|
||||
|
||||
impl Widget for () {
|
||||
fn draw(&mut self, _: &mut Painter) {}
|
||||
fn desired_width(&mut self, _: &mut SizeCtx) -> Len {
|
||||
Len::ZERO
|
||||
}
|
||||
fn desired_height(&mut self, _: &mut SizeCtx) -> Len {
|
||||
Len::ZERO
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WidgetTag;
|
||||
|
||||
Reference in New Issue
Block a user