ui/win32/grid.h

changeset 815
7ddf5fb7ec2a
parent 814
bcb3c7d486f3
child 818
8185cd761897
--- a/ui/win32/grid.h	Wed Oct 08 10:41:35 2025 +0200
+++ b/ui/win32/grid.h	Wed Oct 08 12:36:16 2025 +0200
@@ -32,11 +32,18 @@
 #include <stdbool.h>
 #include <cx/array_list.h>
 
+#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;
     int preferred_width;
@@ -49,10 +56,6 @@
 
 typedef struct GridElm {
     W32Widget *widget;
-    int posx;
-    int posy;
-    int width;
-    int height;
     short gridx;
     short gridy;
     GridLayoutInfo layout;
@@ -61,21 +64,31 @@
 typedef struct UiGridLayout {
     HWND hwnd;
 
-    short padding_top;
-    short padding_bottom;
-    short padding_left;
-    short padding_right;
+    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(const CxAllocator *a, 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, HWND control, short columnspacing, short rowspacing);
 
 void ui_grid_add_widget(
     UiGridLayout *grid,
@@ -84,6 +97,6 @@
     W32Widget *widget,
     GridLayoutInfo *layout);
 
-void ui_grid_layout(UiGridLayout *grid);
+void ui_grid_layout(UiGridLayout *grid, int width, int height);
 
 #endif //GRID_H

mercurial