Add utility method for pushing divs

This commit is contained in:
2023-12-21 19:05:39 +01:00
parent f395076c4e
commit c7ae1279e3
2 changed files with 8 additions and 0 deletions

View File

@@ -427,6 +427,13 @@ BzUINode *bzUINodeMake(BzUI *ui, BzUIKey key, const BzUINodeDesc *desc) {
return node;
}
BzUINode *bzUIPushDiv(BzUI *ui, BzUISize x, BzUISize y) {
return bzUIPushParent(ui, bzUINodeMake(ui, bzUIGetUniqueKey(ui),
&(BzUINodeDesc) {
.semanticSize[BZ_UI_AXIS_X] = x,
.semanticSize[BZ_UI_AXIS_Y] = y,
}));
}
BzUINode *bzUIPushParent(BzUI *ui, BzUINode *node) {
BZ_ASSERT(node);
bzArrayPush(ui->nodeStack, node);

View File

@@ -133,6 +133,7 @@ BzUIKey bzUIGetUniqueKey(BzUI *ui);
BzUINode *bzUINodeMake(BzUI *ui, BzUIKey key, const BzUINodeDesc *desc);
BzUINode *bzUIPushDiv(BzUI *ui, BzUISize x, BzUISize y);
BzUINode *bzUIPushParent(BzUI *ui, BzUINode *node);
BzUINode *bzUIPopParent(BzUI *ui);