This commit is contained in:
2025-11-17 18:33:03 -05:00
parent f5f4547537
commit 955e6b7588
2 changed files with 24 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
mod image; mod image;
mod mask; mod mask;
mod position; mod position;
mod ptr;
mod rect; mod rect;
mod sense; mod sense;
mod text; mod text;
@@ -9,6 +10,7 @@ mod trait_fns;
pub use image::*; pub use image::*;
pub use mask::*; pub use mask::*;
pub use position::*; pub use position::*;
pub use ptr::*;
pub use rect::*; pub use rect::*;
pub use sense::*; pub use sense::*;
pub use text::*; pub use text::*;

22
src/core/ptr.rs Normal file
View File

@@ -0,0 +1,22 @@
use crate::prelude::*;
#[derive(Default)]
pub struct WidgetPtr {
pub inner: Option<WidgetId>,
}
impl Widget for WidgetPtr {
fn draw(&mut self, painter: &mut Painter) {
if let Some(id) = &self.inner {
painter.widget(id);
}
}
fn desired_size(&mut self, ctx: &mut SizeCtx) -> Size {
if let Some(id) = &self.inner {
ctx.size(id)
} else {
Size::ZERO
}
}
}