From 699576eb3358ee6f4d70ca6626a0ff3681ab02f4 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Thu, 23 Jun 2022 19:42:37 +0100 Subject: [PATCH] jwidget: add a jwidget_set_borders() function --- include/justui/jwidget.h | 4 ++++ src/jwidget.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/justui/jwidget.h b/include/justui/jwidget.h index c7f259b..3cdc7ef 100644 --- a/include/justui/jwidget.h +++ b/include/justui/jwidget.h @@ -272,6 +272,10 @@ jwidget_geometry *jwidget_geometry_rw(void *w); border width on a widget's geometry. */ void jwidget_set_border(void *w, jwidget_border_style s, int width, int color); +/* jwidget_set_borders(): Set all four borders */ +void jwidget_set_borders(void *w, jwidget_border_style s, int color, + int top, int right, int bottom, int left); + /* jwidget_set_padding(): Set all padding distances around a widget */ void jwidget_set_padding(void *w, int top, int right, int bottom, int left); diff --git a/src/jwidget.c b/src/jwidget.c index e39e4a8..0f7772f 100644 --- a/src/jwidget.c +++ b/src/jwidget.c @@ -377,6 +377,19 @@ void jwidget_set_border(void *w, jwidget_border_style s, int width, int color) for(int i = 0; i < 4; i++) g->borders[i] = width; } +void jwidget_set_borders(void *w, jwidget_border_style s, int color, + int top, int right, int bottom, int left) +{ + jwidget_geometry *g = jwidget_geometry_rw(w); + + g->border_style = s; + g->border_color = color; + g->border.top = top; + g->border.right = right; + g->border.bottom = bottom; + g->border.left = left; +} + void jwidget_set_padding(void *w, int top, int right, int bottom, int left) { jwidget_geometry *g = jwidget_geometry_rw(w);