Initialize the component in the Window at component creation time

This will allow getting rid of the component as parameter to run()
This commit is contained in:
Simon Hausmann 2020-11-11 19:03:04 +01:00
parent a09355c634
commit 64b92df87e
6 changed files with 34 additions and 4 deletions

View file

@ -114,6 +114,14 @@ public:
vtable::VRef<ComponentVTable> { &Component::component_type, c }, items, &inner);
}
template<typename Component>
void set_component(const Component &c) const
{
auto self_rc = c.self_weak.lock().value();
sixtyfps_component_window_set_component(
&inner, reinterpret_cast<cbindgen_private::ComponentRc *>(&self_rc));
}
private:
cbindgen_private::ComponentWindowOpaque inner;
};