ui/winui/container.h

branch
newapi
changeset 185
4a8b1a748f09
parent 182
6cf690e042bd
child 186
5db4979bf482
--- a/ui/winui/container.h	Sat Sep 23 15:41:23 2023 +0200
+++ b/ui/winui/container.h	Sun Sep 24 12:03:57 2023 +0200
@@ -40,6 +40,11 @@
 #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>
 #include <winrt/Microsoft.UI.Xaml.Markup.h>
 
+
+#define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout))
+#define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE)
+#define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE)
+
 typedef struct UiLayout UiLayout;
 typedef enum UiLayoutBool UiLayoutBool;
 
@@ -68,9 +73,9 @@
 
 struct UiContainer {
     UiLayout layout;
-    int close;
+    int close = 0;
 
-    virtual void Add(Control control, UiBool fill) = 0;
+    virtual void Add(FrameworkElement control, UiBool fill) = 0;
 };
 
 enum UiBoxContainerType {
@@ -81,8 +86,21 @@
 struct UiBoxContainer : UiContainer {
     Grid grid;
     enum UiBoxContainerType type;
+    RowDefinition boxRowDef;
+    ColumnDefinition boxColDef;
 
     UiBoxContainer(Grid grid, enum UiBoxContainerType type);
 
-    void Add(Control control, UiBool fill);
+    void Add(FrameworkElement control, UiBool fill);
 };
+
+struct UiGridContainer : UiContainer {
+    Grid grid;
+    int x = 0;
+    int y = -1;
+    int cols = 0;
+
+    UiGridContainer(Grid grid, int margin, int columnspacing, int rowspacing);
+
+    void Add(FrameworkElement control, UiBool fill);
+};

mercurial