--- a/ui/winui/container.cpp Sun Oct 01 22:34:48 2023 +0200 +++ b/ui/winui/container.cpp Mon Oct 02 09:22:52 2023 +0200 @@ -238,7 +238,7 @@ ui_reset_layout(layout); } -// --------------------- UiFrameContainer --------------------- +// --------------------- UI Frame --------------------- UIWIDGET ui_frame_create(UiObject* obj, UiFrameArgs args) { // create a grid for the frame, that contains the label and a sub-frame @@ -309,6 +309,30 @@ return widget; } +// --------------------- UI ScrolledWindow --------------------- + +UIWIDGET ui_scrolledwindow_create(UiObject* obj, UiContainerArgs args) { + ScrollViewer scrollW = ScrollViewer(); + + // add frame to the parent container + UiObject* current = uic_current_obj(obj); + UI_APPLY_LAYOUT1(current, args); + current->container->Add(scrollW, true); + + UIElement elm = scrollW; + UiWidget* widget = new UiWidget(elm); + + // create a vbox as child container + Grid vbox = Grid(); + scrollW.Content(vbox); + + UiObject* newobj = uic_object_new(obj, widget); + newobj->container = new UiBoxContainer(vbox, UI_CONTAINER_VBOX, args.margin, args.spacing); + uic_obj_add(obj, newobj); + + return widget; +} + /* * -------------------- Layout Functions --------------------