39 lines
1.1 KiB
Zig
39 lines
1.1 KiB
Zig
|
const dim = @import("dimensions.zig");
|
||
|
const pane = @import("pane.zig");
|
||
|
const term = @import("term.zig");
|
||
|
const borders = @import("borders.zig");
|
||
|
const TermIO = term.TermIO;
|
||
|
|
||
|
pub const HorizontalLine = struct {
|
||
|
pane: pane.Pane,
|
||
|
border: borders.Border,
|
||
|
|
||
|
pub fn create(parent: *pane.Pane, dimensions: dim.Dimensions, border: borders.Border) HorizontalLine {
|
||
|
return .{
|
||
|
.pane = pane.Pane{
|
||
|
.parent = parent,
|
||
|
.children = null,
|
||
|
.dimensions = dimensions,
|
||
|
.vtable = .{
|
||
|
.draw = draw,
|
||
|
},
|
||
|
},
|
||
|
.border = border,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
fn draw(pane_ptr: *pane.Pane, term_io: *TermIO) !void {
|
||
|
const self: *HorizontalLine = @fieldParentPtr("pane", pane_ptr);
|
||
|
const y = pane_ptr.calcDims.size.height / 2;
|
||
|
pane_ptr.cursor = .{ .x = 0, .y = y };
|
||
|
pane_ptr.moveCursor(term_io);
|
||
|
for (0..pane_ptr.calcDims.size.width) |_| {
|
||
|
term_io.print("{u}", .{self.border.top});
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
pub const VerticalLine = struct {
|
||
|
pane: pane.Pane,
|
||
|
};
|