refactor: add panel border to keybindview
This commit is contained in:
parent
82257ee4e3
commit
c718924698
1 changed files with 6 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ const input = @import("input");
|
||||||
|
|
||||||
const tui = @import("tui.zig");
|
const tui = @import("tui.zig");
|
||||||
const Widget = @import("Widget.zig");
|
const Widget = @import("Widget.zig");
|
||||||
|
const WidgetList = @import("WidgetList.zig");
|
||||||
const MessageFilter = @import("MessageFilter.zig");
|
const MessageFilter = @import("MessageFilter.zig");
|
||||||
|
|
||||||
pub const name = "keybindview";
|
pub const name = "keybindview";
|
||||||
|
|
@ -23,6 +24,7 @@ plane: Plane,
|
||||||
buffer: Buffer,
|
buffer: Buffer,
|
||||||
|
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
const widget_type: Widget.Type = .panel;
|
||||||
|
|
||||||
const Entry = struct {
|
const Entry = struct {
|
||||||
time: i64,
|
time: i64,
|
||||||
|
|
@ -34,6 +36,7 @@ const Buffer = ArrayList(Entry);
|
||||||
pub fn create(allocator: Allocator, parent: Plane) !Widget {
|
pub fn create(allocator: Allocator, parent: Plane) !Widget {
|
||||||
var n = try Plane.init(&(Widget.Box{}).opts_vscroll(@typeName(Self)), parent);
|
var n = try Plane.init(&(Widget.Box{}).opts_vscroll(@typeName(Self)), parent);
|
||||||
errdefer n.deinit();
|
errdefer n.deinit();
|
||||||
|
const container = try WidgetList.createHStyled(allocator, parent, "panel_frame", .dynamic, widget_type);
|
||||||
const self = try allocator.create(Self);
|
const self = try allocator.create(Self);
|
||||||
errdefer allocator.destroy(self);
|
errdefer allocator.destroy(self);
|
||||||
self.* = .{
|
self.* = .{
|
||||||
|
|
@ -44,7 +47,9 @@ pub fn create(allocator: Allocator, parent: Plane) !Widget {
|
||||||
};
|
};
|
||||||
try tui.message_filters().add(MessageFilter.bind(self, keybind_match));
|
try tui.message_filters().add(MessageFilter.bind(self, keybind_match));
|
||||||
tui.enable_match_events();
|
tui.enable_match_events();
|
||||||
return Widget.to(self);
|
container.ctx = self;
|
||||||
|
try container.add(Widget.to(self));
|
||||||
|
return container.widget();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: *Self, allocator: Allocator) void {
|
pub fn deinit(self: *Self, allocator: Allocator) void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue