# HG changeset patch # User Olaf Wintermann # Date 1731230207 -3600 # Node ID 3a60db9ebb5df9a2b6102307099c745957cdce87 # Parent 5578494147cb7e1892fd466abbf3ff005c49ec16 implement hfill/vfill (WINUI) diff -r 5578494147cb -r 3a60db9ebb5d make/vs/testapp/main.c --- a/make/vs/testapp/main.c Wed Oct 30 15:32:38 2024 +0100 +++ b/make/vs/testapp/main.c Sun Nov 10 10:16:47 2024 +0100 @@ -307,7 +307,11 @@ } } ui_tab(obj, "Tab 4") { - ui_textarea(obj, .varname = "text"); + ui_grid0(obj) { + ui_button(obj, .label = "test1"); + ui_newline(obj); + ui_textarea(obj, .varname = "text", .vexpand = TRUE, .hexpand = TRUE); + } } ui_tab(obj, "Tab 5") { ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button); diff -r 5578494147cb -r 3a60db9ebb5d make/vs/testapp/packages.config --- a/make/vs/testapp/packages.config Wed Oct 30 15:32:38 2024 +0100 +++ b/make/vs/testapp/packages.config Sun Nov 10 10:16:47 2024 +0100 @@ -3,5 +3,5 @@ - + \ No newline at end of file diff -r 5578494147cb -r 3a60db9ebb5d make/vs/testapp/testapp.vcxproj --- a/make/vs/testapp/testapp.vcxproj Wed Oct 30 15:32:38 2024 +0100 +++ b/make/vs/testapp/testapp.vcxproj Sun Nov 10 10:16:47 2024 +0100 @@ -1,8 +1,8 @@ + - Debug @@ -157,21 +157,21 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff -r 5578494147cb -r 3a60db9ebb5d ui/winui/container.cpp --- a/ui/winui/container.cpp Wed Oct 30 15:32:38 2024 +0100 +++ b/ui/winui/container.cpp Sun Nov 10 10:16:47 2024 +0100 @@ -179,13 +179,24 @@ void UiGridContainer::Add(FrameworkElement control, UiBool fill) { GridLength gl; - int hexpand = FALSE; - int vexpand = FALSE; + bool hexpand = false; + bool vexpand = false; + bool hfill = false; + bool vfill = false; + if(layout.fill != UI_LAYOUT_UNDEFINED) { + fill = ui_lb2bool(layout.fill); + } if (layout.hexpand != UI_LAYOUT_UNDEFINED) { hexpand = layout.hexpand; + hfill = true; } if (layout.vexpand != UI_LAYOUT_UNDEFINED) { vexpand = layout.vexpand; + vfill = true; + } + if (fill) { + hfill = true; + vfill = true; } // create new RowDefinition for the new line @@ -203,6 +214,11 @@ } rowdef.Height(gl); grid.RowDefinitions().Append(rowdef); + } else if (vexpand) { + // adjust row + gl.GridUnitType = GridUnitType::Star; + gl.Value = 1; + grid.RowDefinitions().GetAt(y).Height(gl); } // create new columndefinition, if a new column is added @@ -219,11 +235,20 @@ coldef.Width(gl); grid.ColumnDefinitions().Append(coldef); cols++; + } else if(hexpand) { + // adjust column + gl.GridUnitType = GridUnitType::Star; + gl.Value = 1; + grid.ColumnDefinitions().GetAt(x).Width(gl); } // add control - control.HorizontalAlignment(HorizontalAlignment::Stretch); - control.VerticalAlignment(VerticalAlignment::Stretch); + if (hfill) { + control.HorizontalAlignment(HorizontalAlignment::Stretch); + } + if (vfill) { + control.VerticalAlignment(VerticalAlignment::Stretch); + } if (layout.colspan > 0) { grid.SetColumnSpan(control, layout.colspan); diff -r 5578494147cb -r 3a60db9ebb5d ui/winui/packages.config --- a/ui/winui/packages.config Wed Oct 30 15:32:38 2024 +0100 +++ b/ui/winui/packages.config Sun Nov 10 10:16:47 2024 +0100 @@ -3,5 +3,5 @@ - + \ No newline at end of file diff -r 5578494147cb -r 3a60db9ebb5d ui/winui/winui.vcxproj --- a/ui/winui/winui.vcxproj Wed Oct 30 15:32:38 2024 +0100 +++ b/ui/winui/winui.vcxproj Sun Nov 10 10:16:47 2024 +0100 @@ -1,8 +1,8 @@  + - true true @@ -244,21 +244,21 @@ - + Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - - + + \ No newline at end of file