refactor: add panel border to info_view
This commit is contained in:
parent
f87a9cfb6d
commit
15fd338074
1 changed files with 7 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ const std = @import("std");
|
|||
const Allocator = @import("std").mem.Allocator;
|
||||
const Plane = @import("renderer").Plane;
|
||||
const Widget = @import("Widget.zig");
|
||||
const WidgetList = @import("WidgetList.zig");
|
||||
|
||||
pub const name = @typeName(Self);
|
||||
|
||||
|
|
@ -13,15 +14,20 @@ plane: Plane,
|
|||
view_rows: usize = 0,
|
||||
lines: std.ArrayList([]const u8),
|
||||
|
||||
const widget_type: Widget.Type = .panel;
|
||||
|
||||
pub fn create(allocator: Allocator, parent: Plane) !Widget {
|
||||
const self = try allocator.create(Self);
|
||||
errdefer allocator.destroy(self);
|
||||
const container = try WidgetList.createHStyled(allocator, parent, "panel_frame", .dynamic, widget_type);
|
||||
self.* = .{
|
||||
.allocator = allocator,
|
||||
.plane = try Plane.init(&(Widget.Box{}).opts(name), parent),
|
||||
.lines = .empty,
|
||||
};
|
||||
return Widget.to(self);
|
||||
container.ctx = self;
|
||||
try container.add(Widget.to(self));
|
||||
return container.widget();
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Self, allocator: Allocator) void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue