strong & weak widgets
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
use crate::{Ui, WidgetHandle, WidgetIdFn, WidgetLike};
|
||||
use crate::{Ui, WidgetIdFn, WidgetLike, WidgetView};
|
||||
|
||||
pub trait WidgetAttr<W> {
|
||||
pub trait WidgetAttr<W: ?Sized> {
|
||||
type Input;
|
||||
fn run(ui: &mut Ui, id: &WidgetHandle<W>, input: Self::Input);
|
||||
fn run(ui: &mut Ui, id: WidgetView<W>, input: Self::Input);
|
||||
}
|
||||
|
||||
pub trait Attrable<W, Tag> {
|
||||
pub trait Attrable<W: ?Sized, Tag> {
|
||||
fn attr<A: WidgetAttr<W>>(self, input: A::Input) -> impl WidgetIdFn<W>;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ impl<WL: WidgetLike<Tag>, Tag> Attrable<WL::Widget, Tag> for WL {
|
||||
fn attr<A: WidgetAttr<WL::Widget>>(self, input: A::Input) -> impl WidgetIdFn<WL::Widget> {
|
||||
|ui| {
|
||||
let id = self.add(ui);
|
||||
A::run(ui, &id, input);
|
||||
A::run(ui, id.weak(), input);
|
||||
id
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user