WIP: Add item_geometry to the ComponentVTable

(unused yet)
This commit is contained in:
Olivier Goffart 2023-06-30 09:17:17 +02:00 committed by Olivier Goffart
parent 2a8ebb9752
commit e0fd9a6105
16 changed files with 222 additions and 28 deletions

View file

@ -85,6 +85,14 @@ inline ItemRef get_item_ref(ComponentRef component,
return ItemRef { item.vtable, reinterpret_cast<char *>(component.instance) + item.offset };
}
/// Convert a slint `{height: length, width: length, x: length, y: length}` to a Rect
inline cbindgen_private::Rect convert_anonymous_rect(std::tuple<float, float, float, float> tuple)
{
// alphabetical order
auto [h, w, x, y] = tuple;
return cbindgen_private::Rect { .x = x, .y = y, .width = w, .height = h };
}
inline void dealloc(const ComponentVTable *, uint8_t *ptr, vtable::Layout layout)
{
#ifdef __cpp_sized_deallocation