commit 70c441f34ae6efd331b58999cf2e384fda46b795 from: Onana Onana Xavier Manuel date: Tue Jul 14 14:52:00 2026 UTC Grid geometry manager update * Added support for rowspan/columnspan * Rowconfigure/Columnconfigure added but not implemented yet * Fixed typo in aui_run.3 commit - 8964e49031e0a23aaa0d9d2155a62bba92b5d587 commit + 70c441f34ae6efd331b58999cf2e384fda46b795 blob - ccd50669b42d5dede1f47fd5c71ba7d1e2d0841c blob + b6bba5be8e4d8dab5b465b9d95bc5b6ec73983e9 --- aui.h +++ aui.h @@ -50,8 +50,26 @@ struct aui_gridpar { unsigned int row; unsigned int columnspan; unsigned int rowspan; + unsigned int ipadx; /* Internal padding X */ + unsigned int ipady; /* Internal padding Y */ + unsigned int padx; + unsigned int pady; }; +struct aui_rowpar { + unsigned int minsize; + unsigned char weight; /* Minimum is 1 */ + unsigned char uniform; + unsigned int pad; +}; + +struct aui_columnpar { + unsigned int minsize; + unsigned char weight; /* Minimum is 1 */ + unsigned char uniform; + unsigned int pad; +}; + struct aui_widget; struct aui_window; struct aui_frame; @@ -104,6 +122,12 @@ int aui_getplacepar(struct aui_widget *, struct aui_pl int aui_getgridpar(struct aui_widget *, struct aui_gridpar *); int aui_getpackpar(struct aui_widget *, struct aui_packpar *); +/* + * Grid container operations + */ +int aui_rowconfigure(struct aui_widget *, struct aui_rowpar *); +int aui_columnconfigure(struct aui_widget *, struct aui_columnpar *); + #define AUI_CANVAS_RECTANGLE 0 #define AUI_CANVAS_ARC 1 #define AUI_CANVAS_IMAGE 2 blob - 1b3320cb09ed30ffbbde8bfc71b9fe9ba82c5989 blob + 27247026aac62a520238719eea0fa73522bf1522 --- aui_run.3 +++ aui_run.3 @@ -1,4 +1,4 @@ -.Dd $Mdocdate: July 08 2026$ +.Dd $Mdocdate: July 14 2026$ .Dt AUI_RUN 3 .Os .Sh NAME @@ -84,7 +84,7 @@ container like frame. Here is an example. .Pp .Bd -literal -offset indent struct aui_frame *frame = aui_frame_new(AUI_WIDGET(aw), NULL); -struct aui_button *btn = aui_button_new(AUI_WIDGET(frame)); +struct aui_button *btn = aui_button_new(AUI_WIDGET(frame), NULL); .Ed .Pp Adding widgets to containers does not make them directly visible. You must blob - 3dffb8bcb5cb44e27c408169d974618992e39e19 blob + 04f9802db7f7f7fdae95cbd69298af6a4af608b4 --- layout.c +++ layout.c @@ -27,8 +27,28 @@ static struct aui_packpar default_pack = { static struct aui_gridpar default_grid = { .column = 0, .row = 0, + .columnspan = 1, + .rowspan = 1, + .ipadx = 0, + .ipady = 0, + .padx = 0, + .pady = 0 }; +static struct aui_rowpar default_rowconfigure = { + .minsize = 0, + .weight = 1, + .uniform = 0, + .pad = 0, +}; + +static struct aui_rowpar default_columnconfigure = { + .minsize = 0, + .weight = 1, + .uniform = 0, + .pad = 0, +}; + static int can_add(struct aui_widget *widget, enum aui_layout_type type) { @@ -134,6 +154,9 @@ grid(struct aui_widget *widget) unsigned int *rsize = con->row_sizes; unsigned int *csize = con->col_sizes; + memset(con->row_maps, 0, sizeof(*con->row_maps) * con->grid_size[1]); + memset(con->col_maps, 0, sizeof(*con->col_maps) * con->grid_size[0]); + memset(con->row_sizes, 0, sizeof(*con->row_sizes) * con->grid_size[1]); memset(con->col_sizes, 0, sizeof(*con->col_sizes) * con->grid_size[0]); @@ -175,14 +198,31 @@ grid(struct aui_widget *widget) struct aui_geometry min = child->ops->get_min_size(child); struct aui_geometry geom = { 0 }; + struct aui_gridpar *gpar = &child->gridpar; + int cspan = (gpar->column + gpar->columnspan) <= con->grid_size[0] ? + gpar->columnspan - 1: con->grid_size[0] - gpar->column - 1; + + int rspan = (gpar->row + gpar->rowspan) <= con->grid_size[1] ? + gpar->rowspan - 1: con->grid_size[1] - gpar->row - 1; + + int dx = (csize[child->gridpar.column] - min.width); int dy = (rsize[child->gridpar.row] - min.height); + int width = min.width; + int height = min.height; + + for (int i = gpar->column; i < gpar->column + cspan; i++) + width += csize[i]; + + for (int i = gpar->row; i < gpar->row + rspan; i++) + height += rsize[i]; + geom.x = widget->geom.x + cpos[child->gridpar.column] + dx / 2; geom.y = widget->geom.y + rpos[child->gridpar.row] + dy / 2; - geom.width = min.width; - geom.height = min.height; + geom.width = width; + geom.height = height; child->ops->set_geometry(child, &geom); } blob - 7a83c3dbf2d1c03d32bd4dd5371081607aaee0b2 blob + ff0077c16e3465ac05c6d6ec98065e4f0a6f14ba --- widget.h +++ widget.h @@ -73,6 +73,8 @@ struct aui_container { unsigned int *col_sizes; unsigned int *row_pos; unsigned int *col_pos; + struct aui_rowpar *rowconfigure; + struct aui_columnpar *columnconfigure; struct container_focus { struct aui_widget *press;