sized widgets!
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
use crate::layout::{Painter, Ui, WidgetId, WidgetIdFnRet};
|
||||
use crate::layout::{Painter, TextData, Textures, Ui, Vec2, WidgetId, WidgetIdFnRet};
|
||||
|
||||
use std::{any::Any, marker::PhantomData};
|
||||
|
||||
pub trait Widget: Any {
|
||||
fn draw(&self, painter: &mut Painter);
|
||||
fn draw(&mut self, painter: &mut Painter);
|
||||
fn size(&mut self, ctx: SizeCtx) -> Vec2 {
|
||||
ctx.size
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SizeCtx<'a> {
|
||||
pub size: Vec2,
|
||||
pub text: &'a mut TextData,
|
||||
pub textures: &'a mut Textures,
|
||||
}
|
||||
|
||||
pub struct WidgetTag;
|
||||
|
||||
Reference in New Issue
Block a user