]> git.lizzy.rs Git - nothing.git/blob - src/ui/grid.c
Remove Lt from Edit_field
[nothing.git] / src / ui / grid.c
1 #include "grid.h"
2
3 void grid_relayout(Grid *grid, Rect boundary)
4 {
5     const float cell_width = boundary.w / (float) grid->columns;
6     const float cell_height = boundary.h / (float) grid->rows;
7
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];
11             if (cell) {
12                 cell->boundary = rect(
13                     boundary.x + (float) column * cell_width,
14                     boundary.y + (float) row * cell_height,
15                     cell_width, cell_height);
16             }
17         }
18     }
19 }