mod(memory): do not create items on the stack instead using the provided allocator
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 4m26s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 4m26s
This commit is contained in:
@@ -31,62 +31,46 @@ 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: {
|
||||
var tabs = Layout.Tab.init(allocator, .{}, .{
|
||||
.{
|
||||
Layout.createFrom(margin: {
|
||||
var margin = Layout.Margin.init(allocator, .{ .margin = 10 }, .{
|
||||
.widget = Widget.createFrom(blk: {
|
||||
const file = try std.fs.cwd().openFile("./examples/tabs.zig", .{});
|
||||
defer file.close();
|
||||
var widget = Widget.RawText.init(allocator, file);
|
||||
break :blk &widget;
|
||||
}),
|
||||
});
|
||||
break :margin &margin;
|
||||
var layout = Layout.createFrom(Layout.Tab.init(allocator, .{}, .{
|
||||
.{
|
||||
Layout.createFrom(Layout.Margin.init(allocator, .{ .margin = 10 }, .{
|
||||
.widget = Widget.createFrom(blk: {
|
||||
const file = try std.fs.cwd().openFile("./examples/tabs.zig", .{});
|
||||
defer file.close();
|
||||
break :blk Widget.RawText.init(allocator, file);
|
||||
}),
|
||||
"Tab 2",
|
||||
Cell.Style.Color{ .index = 6 },
|
||||
},
|
||||
.{
|
||||
Layout.createFrom(framing: {
|
||||
var framing = Layout.Framing.init(
|
||||
allocator,
|
||||
.{
|
||||
.frame = .round,
|
||||
.title = .{
|
||||
.str = "Content in Margin",
|
||||
.style = .{
|
||||
.ul_style = .single,
|
||||
.ul = .{ .index = 4 },
|
||||
.bold = true,
|
||||
},
|
||||
},
|
||||
})),
|
||||
"Tab 2",
|
||||
Cell.Style.Color{ .index = 6 },
|
||||
},
|
||||
.{
|
||||
Layout.createFrom(Layout.Framing.init(
|
||||
allocator,
|
||||
.{
|
||||
.frame = .round,
|
||||
.title = .{
|
||||
.str = "Content in Margin",
|
||||
.style = .{
|
||||
.ul_style = .single,
|
||||
.ul = .{ .index = 4 },
|
||||
.bold = true,
|
||||
},
|
||||
.{
|
||||
.layout = Layout.createFrom(margin: {
|
||||
var margin = Layout.Margin.init(allocator, .{ .margin = 10 }, .{
|
||||
.widget = Widget.createFrom(blk: {
|
||||
var widget = Widget.List.init(allocator, .ordered, .{
|
||||
&[_]Cell{.{ .content = "First entry" }},
|
||||
&[_]Cell{.{ .content = "Second entry" }},
|
||||
&[_]Cell{.{ .content = "Third entry" }},
|
||||
});
|
||||
break :blk &widget;
|
||||
}),
|
||||
});
|
||||
break :margin &margin;
|
||||
}),
|
||||
},
|
||||
);
|
||||
break :framing &framing;
|
||||
}),
|
||||
"Tab 1",
|
||||
Cell.Style.Color{ .index = 4 },
|
||||
},
|
||||
});
|
||||
break :layout &tabs;
|
||||
});
|
||||
},
|
||||
},
|
||||
.{
|
||||
.layout = Layout.createFrom(Layout.Margin.init(allocator, .{ .margin = 10 }, .{
|
||||
.widget = Widget.createFrom(Widget.List.init(allocator, .ordered, .{
|
||||
&[_]Cell{.{ .content = "First entry" }},
|
||||
&[_]Cell{.{ .content = "Second entry" }},
|
||||
&[_]Cell{.{ .content = "Third entry" }},
|
||||
})),
|
||||
})),
|
||||
},
|
||||
)),
|
||||
"Tab 1",
|
||||
Cell.Style.Color{ .index = 4 },
|
||||
},
|
||||
}));
|
||||
defer layout.deinit();
|
||||
|
||||
try app.start(null);
|
||||
|
||||
Reference in New Issue
Block a user