From 8b56dcd3dd284c27622e09c0d2a2261be2dbc27d Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Wed, 24 May 2023 21:11:00 +0300 Subject: [PATCH] add convenience function to box layout to set all margins --- src/box-layout-node.c | 8 ++++++++ src/box-layout-node.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/box-layout-node.c b/src/box-layout-node.c index 6355042..7b6dbc9 100644 --- a/src/box-layout-node.c +++ b/src/box-layout-node.c @@ -143,6 +143,14 @@ int box_layout_handle(UINode *component, enum UIEvent ev, size_t d, void *p) return 0; } +void box_layout_set_margins(UIBoxLayoutNode *layout, double margin) +{ + layout->margin_top = margin; + layout->margin_left = margin; + layout->margin_bottom = margin; + layout->margin_right = margin; +} + UIBoxLayoutNode *box_layout_new(UINode *parent, enum UIDirection direction) { UIBoxLayoutNode *n = malloc(sizeof(UIBoxLayoutNode)); diff --git a/src/box-layout-node.h b/src/box-layout-node.h index be7327f..078f409 100644 --- a/src/box-layout-node.h +++ b/src/box-layout-node.h @@ -10,6 +10,7 @@ typedef struct UIBoxLayoutNode { } UIBoxLayoutNode; UIBoxLayoutNode *box_layout_new(UINode *parent, enum UIDirection direction); +void box_layout_set_margins(UIBoxLayoutNode *layout, double margin); int box_layout_handle(UINode *component, enum UIEvent ev, size_t d, void *p); #endif // _UI__BOX_LAYOUT_NODE_H