mod: use allocators for Layout and Widget types

This commit is contained in:
2024-11-19 22:56:37 +01:00
parent cd12fb12e6
commit 1c703a196a
18 changed files with 264 additions and 153 deletions

View File

@@ -31,14 +31,14 @@ pub fn main() !void {
// TODO: when not running fullscreen, the application needs to screen down accordingly to display the contents
// -> size hint how much should it use?
var layout = Layout.createFrom(Layout.VContainer.init(allocator, .{
var layout = Layout.createFrom(allocator, Layout.VContainer.init(allocator, .{
.{
Widget.createFrom(Widget.Spacer.init(allocator)),
Widget.createFrom(allocator, Widget.Spacer.init(allocator)),
45,
},
.{
Layout.createFrom(Layout.Framing.init(allocator, .{}, .{
.widget = Widget.createFrom(Widget.Text.init(allocator, .center, &[_]Cell{
Layout.createFrom(allocator, Layout.Framing.init(allocator, .{}, .{
.widget = Widget.createFrom(allocator, Widget.Text.init(allocator, .center, &[_]Cell{
.{ .content = "Press " },
.{ .content = "Ctrl+n", .style = .{ .fg = .{ .index = 6 } } },
.{ .content = " to launch $EDITOR" },
@@ -47,7 +47,7 @@ pub fn main() !void {
10,
},
.{
Widget.createFrom(Widget.Spacer.init(allocator)),
Widget.createFrom(allocator, Widget.Spacer.init(allocator)),
45,
},
}));