aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-07-02 04:42:41 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-07-02 04:42:41 +0200
commitac913a3ff5369fa44c0f8605b6eee8c550671189 (patch)
tree8759d74ca9702376e34757753082001dd1de170e /src
parent1d40cadf43528c825b64539f48a66063765b132a (diff)
downloadjancity-ac913a3ff5369fa44c0f8605b6eee8c550671189.tar.gz
gui/container: support spacing between GUI elements
Diffstat (limited to 'src')
-rw-r--r--src/gui/inc/gui/container.h2
-rw-r--r--src/gui/src/container.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/inc/gui/container.h b/src/gui/inc/gui/container.h
index d290424..235259c 100644
--- a/src/gui/inc/gui/container.h
+++ b/src/gui/inc/gui/container.h
@@ -13,7 +13,7 @@ extern "C"
struct gui_container
{
struct gui_common common;
- short w, h;
+ short w, h, spacing;
enum
{
diff --git a/src/gui/src/container.c b/src/gui/src/container.c
index 1021b95..f026741 100644
--- a/src/gui/src/container.c
+++ b/src/gui/src/container.c
@@ -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;