gui/container: support spacing between GUI elements

This commit is contained in:
Xavier Del Campo Romero 2022-07-02 04:42:41 +02:00
parent 93d2c39b1b
commit 7325906351
2 changed files with 7 additions and 1 deletions

View File

@ -13,7 +13,7 @@ extern "C"
struct gui_container
{
struct gui_common common;
short w, h;
short w, h, spacing;
enum
{

View File

@ -15,6 +15,9 @@ static void add_child(struct gui_common *const parent,
switch (c->mode)
{
case GUI_CONTAINER_MODE_H:
if (c->w)
c->w += c->spacing;
child->x += c->w;
c->w += w;
@ -24,6 +27,9 @@ static void add_child(struct gui_common *const parent,
break;
case GUI_CONTAINER_MODE_V:
if (c->h)
c->h += c->spacing;
child->y += c->h;
c->h += h;