ui/winui/container.h

branch
newapi
changeset 185
4a8b1a748f09
parent 182
6cf690e042bd
child 186
5db4979bf482
equal deleted inserted replaced
184:8c9b4b28aaa9 185:4a8b1a748f09
38 #include <winrt/Microsoft.UI.Xaml.Controls.h> 38 #include <winrt/Microsoft.UI.Xaml.Controls.h>
39 #include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h> 39 #include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h>
40 #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h> 40 #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>
41 #include <winrt/Microsoft.UI.Xaml.Markup.h> 41 #include <winrt/Microsoft.UI.Xaml.Markup.h>
42 42
43
44 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout))
45 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE)
46 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE)
47
43 typedef struct UiLayout UiLayout; 48 typedef struct UiLayout UiLayout;
44 typedef enum UiLayoutBool UiLayoutBool; 49 typedef enum UiLayoutBool UiLayoutBool;
45 50
46 using namespace winrt; 51 using namespace winrt;
47 using namespace Microsoft::UI::Xaml; 52 using namespace Microsoft::UI::Xaml;
66 int gridwidth; 71 int gridwidth;
67 }; 72 };
68 73
69 struct UiContainer { 74 struct UiContainer {
70 UiLayout layout; 75 UiLayout layout;
71 int close; 76 int close = 0;
72 77
73 virtual void Add(Control control, UiBool fill) = 0; 78 virtual void Add(FrameworkElement control, UiBool fill) = 0;
74 }; 79 };
75 80
76 enum UiBoxContainerType { 81 enum UiBoxContainerType {
77 UI_CONTAINER_HBOX = 0, 82 UI_CONTAINER_HBOX = 0,
78 UI_CONTAINER_VBOX 83 UI_CONTAINER_VBOX
79 }; 84 };
80 85
81 struct UiBoxContainer : UiContainer { 86 struct UiBoxContainer : UiContainer {
82 Grid grid; 87 Grid grid;
83 enum UiBoxContainerType type; 88 enum UiBoxContainerType type;
89 RowDefinition boxRowDef;
90 ColumnDefinition boxColDef;
84 91
85 UiBoxContainer(Grid grid, enum UiBoxContainerType type); 92 UiBoxContainer(Grid grid, enum UiBoxContainerType type);
86 93
87 void Add(Control control, UiBool fill); 94 void Add(FrameworkElement control, UiBool fill);
88 }; 95 };
96
97 struct UiGridContainer : UiContainer {
98 Grid grid;
99 int x = 0;
100 int y = -1;
101 int cols = 0;
102
103 UiGridContainer(Grid grid, int margin, int columnspacing, int rowspacing);
104
105 void Add(FrameworkElement control, UiBool fill);
106 };

mercurial