This commit is contained in:
2025-08-10 19:10:26 -04:00
parent 577d62b1da
commit 848347e6b3
4 changed files with 17 additions and 19 deletions

View File

@@ -31,8 +31,12 @@ impl From<UI> for UIBuilder {
}
impl UIBuilder {
pub fn add<W: Widget>(&mut self, w: W) -> WidgetRef<W> {
WidgetRef::new(self.clone(), [self.push(w)])
pub fn add<W: Widget>(&mut self, w: impl WidgetLike<Widget = W>) -> WidgetRef<W> {
WidgetRef::new([w.add(self).erase_type()])
}
pub fn add_widget<W: Widget>(&mut self, w: W) -> WidgetRef<W> {
WidgetRef::new([self.push(w)])
}
pub fn push<W: Widget>(&mut self, w: W) -> WidgetId {