mod: change widget interface Widget.content replaced with Widget.render
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 29s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 29s
The .resize `Event` has been adapted to include an _anchor_, which provide the full necessary information for each widget where to render on the screen with what requested size. Each Widget can then dynamically decide how and what to render (i.e. provide placeholder text in case the size is too small, etc.).
This commit is contained in:
@@ -6,7 +6,7 @@ const Error = @import("../event.zig").Error;
|
||||
|
||||
const log = std.log.scoped(.widget_spacer);
|
||||
|
||||
pub fn Widget(comptime Event: type) type {
|
||||
pub fn Widget(comptime Event: type, comptime Renderer: type) type {
|
||||
if (!isTaggedUnion(Event)) {
|
||||
@compileError("Provided user event `Event` for `Layout(comptime Event: type)` is not of type `union(enum)`.");
|
||||
}
|
||||
@@ -25,9 +25,10 @@ pub fn Widget(comptime Event: type) type {
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn content(this: *@This()) ![]u8 {
|
||||
pub fn render(this: *@This(), renderer: Renderer) !void {
|
||||
// FIX: this should rather clear the `terminal.Size` provided through the event system using the _renderer_.
|
||||
_ = this;
|
||||
return &[0]u8{};
|
||||
_ = renderer;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user