const dim = @import("dimensions.zig"); const pane = @import("pane.zig"); const term = @import("term.zig"); const borders = @import("borders.zig"); const Pane = pane.Pane; const Style = pane.Style; const TermIO = term.TermIO; pub const HorizontalLine = struct { pane: Pane, border: borders.Border, const Config = struct { border: borders.Border, style: Style, }; pub fn create(mem: *HorizontalLine, config: Config) *Pane { mem.border = config.border; mem.pane = Pane{ .style = config.style, .vtable = .{ .draw = draw, }, }; return &mem.pane; } fn draw(pane_ptr: *Pane, term_io: *TermIO) !void { const self: *HorizontalLine = @fieldParentPtr("pane", pane_ptr); const y = pane_ptr.dimensions.size.height / 2; pane_ptr.cursor = .{ .x = 0, .y = y }; pane_ptr.moveCursor(term_io); for (0..pane_ptr.dimensions.size.width) |_| { term_io.print("{u}", .{self.border.top}); } } }; pub const VerticalLine = struct { pane: Pane, border: borders.Border, const Config = struct { border: borders.Border, style: Style, }; pub fn create(mem: *VerticalLine, config: Config) *Pane { mem.border = config.border; mem.pane = Pane{ .style = config.style, .vtable = .{ .draw = draw, }, }; return &mem.pane; } fn draw(pane_ptr: *Pane, term_io: *TermIO) !void { const self: *VerticalLine = @fieldParentPtr("pane", pane_ptr); const x = pane_ptr.dimensions.size.width / 2; for (0..pane_ptr.dimensions.size.height) |h| { pane_ptr.cursor = .{ .x = x, .y = h }; pane_ptr.moveCursor(term_io); term_io.print("{u}", .{self.border.left}); } } };