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

@@ -30,10 +30,10 @@ 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.Padding.init(allocator, .{
var layout = Layout.createFrom(allocator, Layout.Padding.init(allocator, .{
.padding = 15,
}, .{
.layout = Layout.createFrom(Layout.Framing.init(allocator, .{
.layout = Layout.createFrom(allocator, Layout.Framing.init(allocator, .{
.style = .{
.fg = .{
.index = 6,
@@ -49,13 +49,13 @@ pub fn main() !void {
},
},
}, .{
.layout = Layout.createFrom(Layout.Margin.init(
.layout = Layout.createFrom(allocator, Layout.Margin.init(
allocator,
.{
.margin = 10,
},
.{
.widget = Widget.createFrom(blk: {
.widget = Widget.createFrom(allocator, blk: {
const file = try std.fs.cwd().openFile("./examples/padding.zig", .{});
defer file.close();
const widget = Widget.RawText.init(allocator, file);