ui/winui/container.cpp

branch
newapi
changeset 188
fbbae6738252
parent 186
5db4979bf482
child 190
70fd1b24e395
--- a/ui/winui/container.cpp	Sun Oct 01 12:08:09 2023 +0200
+++ b/ui/winui/container.cpp	Sun Oct 01 14:40:43 2023 +0200
@@ -49,6 +49,30 @@
 
 // --------------------- UiBoxContainer ---------------------
 
+static UIWIDGET ui_box(UiObject* obj, UiBoxContainerType type) {
+	UiContainer* ct = uic_get_current_container(obj);
+
+	Grid grid = Grid();
+	ct->Add(grid, true);
+
+	UIElement elm = grid;
+	UiWidget* widget = new UiWidget(elm);
+
+	UiObject* newobj = uic_object_new(obj, widget);
+	newobj->container = new UiBoxContainer(grid, type);
+	uic_obj_add(obj, newobj);
+
+	return widget;
+}
+
+UIWIDGET ui_vbox(UiObject* obj) {
+	return ui_box(obj, UI_CONTAINER_VBOX);
+}
+
+UIWIDGET ui_hbox(UiObject* obj) {
+	return ui_box(obj, UI_CONTAINER_HBOX);
+}
+
 UiBoxContainer::UiBoxContainer(Grid grid, enum UiBoxContainerType type) {
 	this->grid = grid;
 	this->type = type;
@@ -109,7 +133,8 @@
 	ui_reset_layout(layout);
 }
 
-// --------------------- UiBoxContainer ---------------------
+
+// --------------------- UiGridContainer ---------------------
 
 UIWIDGET ui_grid(UiObject* obj) {
 	return ui_grid_sp(obj, 0, 0, 0);

mercurial