mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 05:14:48 +00:00
Put the CompoentType inside the class in the generated code
and start working on safe wrapper
This commit is contained in:
parent
bdaf14ae23
commit
2f16517291
3 changed files with 89 additions and 23 deletions
|
@ -7,14 +7,18 @@ namespace sixtyfps {
|
|||
using internal::ItemTreeNode;
|
||||
using internal::ComponentType;
|
||||
|
||||
template<typename Component> void run(Component *c, const ComponentType *t) {
|
||||
template<typename Component> void run(Component *c) {
|
||||
// FIXME! some static assert that the component is indeed a generated component matching
|
||||
// the vtable. In fact, i think the VTable should be a static member of the Component
|
||||
internal::sixtyfps_runtime_run_component(t, reinterpret_cast<internal::ComponentImpl *>(c));
|
||||
internal::sixtyfps_runtime_run_component(&Component::component_type, reinterpret_cast<internal::ComponentImpl *>(c));
|
||||
}
|
||||
|
||||
using internal::Rectangle;
|
||||
using internal::RectangleVTable;
|
||||
using internal::Image;
|
||||
using internal::ImageVTable;
|
||||
|
||||
// the component has static lifetime so it does not need to be destroyed
|
||||
// FIXME: we probably need some kind of way to dinstinguish static component and these on the heap
|
||||
inline void dummy_destory(const ComponentType *, internal::ComponentImpl *) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue