refactor: add focus/unfocus to widget vtable

This commit is contained in:
CJ van den Berg 2025-11-06 18:16:16 +01:00
parent 70cc191c4a
commit 3437f4fd20
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 42 additions and 0 deletions

View file

@ -404,6 +404,14 @@ pub fn walk(self: *Self, ctx: *anyopaque, f: Widget.WalkFn, self_w: *Widget) boo
return f(ctx, self_w);
}
pub fn focus(self: *Self) void {
for (self.widgets.items) |*w| w.widget.focus();
}
pub fn unfocus(self: *Self) void {
for (self.widgets.items) |*w| w.widget.unfocus();
}
pub fn hover(self: *Self) bool {
for (self.widgets.items) |*w| if (w.widget.hover()) return true;
return false;