refactor: add focus/unfocus to widget vtable
This commit is contained in:
parent
70cc191c4a
commit
3437f4fd20
3 changed files with 42 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue