--- a/ui/win32/grid.h Sat Oct 04 14:54:25 2025 +0200 +++ b/ui/win32/grid.h Sun Oct 19 21:20:08 2025 +0200 @@ -28,47 +28,64 @@ #ifndef GRID_H #define GRID_H -#include "container.h" +#include "../ui/win32.h" #include <stdbool.h> #include <cx/array_list.h> -typedef struct GridElm { - W32Widget *widget; - short x; - short y; - GridLayoutInfo layout; -} GridElm; +#include "win32.h" + +#define INSETS_ZERO (GridEdgeInsets){0} +typedef struct GridEdgeInsets { + short top; + short bottom; + short left; + short right; +} GridEdgeInsets; typedef struct GridLayoutInfo { - short margin_left; - short margin_right; - short margin_top; - short margin_bottom; + GridEdgeInsets margin; short colspan; short rowspan; - short preferred_width; - short preferred_height; + int preferred_width; + int preferred_height; bool hexpand; bool vexpand; bool hfill; bool vfill; } GridLayoutInfo; +typedef struct GridElm { + W32Widget *widget; + short gridx; + short gridy; + GridLayoutInfo layout; +} GridElm; + typedef struct UiGridLayout { - HWND hwnd; - - short padding; + GridEdgeInsets padding; short columnspacing; short rowspacing; + int preferred_width; + int preferred_height; + /* * list element type: GridElm */ CxList *widgets; + int max_column; + int max_row; } UiGridLayout; -UiGridLayout* ui_grid_container(UiObject *obj, HWND control, short padding, short columnspacing, short rowspacing); +typedef struct GridDef { + int size; + int pos; + int preferred_size; + BOOLEAN expand; +} GridDef; + +UiGridLayout* ui_grid_layout_create(const CxAllocator *a, short columnspacing, short rowspacing); void ui_grid_add_widget( UiGridLayout *grid, @@ -77,6 +94,6 @@ W32Widget *widget, GridLayoutInfo *layout); -void ui_grid_layout(UiGridLayout *grid); +void ui_grid_layout(UiGridLayout *grid, int width, int height); #endif //GRID_H