refactor: move command and EventHandler out of the tui module

This commit is contained in:
CJ van den Berg 2024-10-25 22:39:04 +02:00
parent f41fb97d02
commit 16c5471126
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
45 changed files with 132 additions and 81 deletions

View file

@ -2,7 +2,7 @@ const std = @import("std");
const Allocator = std.mem.Allocator;
const tp = @import("thespian");
const tracy = @import("tracy");
const EventHandler = @import("EventHandler");
const Plane = @import("renderer").Plane;
const Widget = @import("../Widget.zig");
@ -14,11 +14,11 @@ cursels: usize = 0,
selection: ?ed.Selection = null,
buf: [256]u8 = undefined,
rendered: [:0]const u8 = "",
on_event: ?Widget.EventHandler,
on_event: ?EventHandler,
const Self = @This();
pub fn create(allocator: Allocator, parent: Plane, event_handler: ?Widget.EventHandler) @import("widget.zig").CreateError!Widget {
pub fn create(allocator: Allocator, parent: Plane, event_handler: ?EventHandler) @import("widget.zig").CreateError!Widget {
const self: *Self = try allocator.create(Self);
self.* = .{
.plane = try Plane.init(&(Widget.Box{}).opts(@typeName(Self)), parent),