Make command dispatching work

This commit is contained in:
Conrad Irwin 2023-11-09 13:23:30 -07:00
parent a1d9f351db
commit fa153a0d56
11 changed files with 188 additions and 118 deletions

View file

@ -145,7 +145,7 @@ impl<V> Eq for WeakView<V> {}
#[derive(Clone, Debug)]
pub struct AnyView {
model: AnyModel,
initialize: fn(&AnyView, &mut WindowContext) -> AnyBox,
pub initialize: fn(&AnyView, &mut WindowContext) -> AnyBox,
layout: fn(&AnyView, &mut AnyBox, &mut WindowContext) -> LayoutId,
paint: fn(&AnyView, &mut AnyBox, &mut WindowContext),
}
@ -184,6 +184,10 @@ impl AnyView {
.compute_layout(layout_id, available_space);
(self.paint)(self, &mut rendered_element, cx);
}
pub(crate) fn draw_dispatch_stack(&self, cx: &mut WindowContext) {
(self.initialize)(self, cx);
}
}
impl<V: 'static> Component<V> for AnyView {