This commit is contained in:
2025-12-03 22:51:33 -05:00
parent d6a9711ceb
commit 84c460a91f
7 changed files with 66 additions and 8 deletions

View File

@@ -1,4 +1,7 @@
use crate::layout::{Len, Painter, SizeCtx, StaticWidgetId, Ui, WidgetId, WidgetIdFn};
use crate::{
core::WidgetPtr,
layout::{Len, Painter, SizeCtx, StaticWidgetId, Ui, WidgetId, WidgetIdFn},
};
use std::{any::Any, marker::PhantomData};
@@ -48,6 +51,12 @@ pub trait WidgetLike<Tag> {
{
ui.set_root(self);
}
fn set_ptr(self, ptr: &WidgetId<WidgetPtr>, ui: &mut Ui)
where
Self: Sized,
{
ui[ptr].inner = Some(self.add(ui).any());
}
}
/// A function that returns a widget given a UI.