3 void grid_relayout(Grid *grid, Rect boundary)
5 const float cell_width = boundary.w / (float) grid->columns;
6 const float cell_height = boundary.h / (float) grid->rows;
8 for (size_t row = 0; row < grid->rows; ++row) {
9 for (size_t column = 0; column < grid->columns; ++column) {
10 Widget *cell = grid->cells[row * grid->columns + column];
12 cell->boundary = rect(
13 boundary.x + (float) column * cell_width,
14 boundary.y + (float) row * cell_height,
15 cell_width, cell_height);