jwidget: add a jwidget_set_borders() function

This commit is contained in:
Lephenixnoir 2022-06-23 19:42:37 +01:00
parent ee98be1cc1
commit 699576eb33
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
2 changed files with 17 additions and 0 deletions

View file

@ -272,6 +272,10 @@ jwidget_geometry *jwidget_geometry_rw(void *w);
border width on a widget's geometry. */ border width on a widget's geometry. */
void jwidget_set_border(void *w, jwidget_border_style s, int width, int color); 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 */ /* jwidget_set_padding(): Set all padding distances around a widget */
void jwidget_set_padding(void *w, int top, int right, int bottom, int left); void jwidget_set_padding(void *w, int top, int right, int bottom, int left);

View file

@ -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; 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) void jwidget_set_padding(void *w, int top, int right, int bottom, int left)
{ {
jwidget_geometry *g = jwidget_geometry_rw(w); jwidget_geometry *g = jwidget_geometry_rw(w);