refactor: allow changing the hover mouse cursor for buttons

This commit is contained in:
CJ van den Berg 2026-01-20 20:13:01 +01:00
parent dac695f010
commit d891af6553
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -13,6 +13,7 @@ pub fn Options(context: type) type {
label: []const u8 = "button",
pos: Widget.Box = .{ .y = 0, .x = 0, .w = 8, .h = 1 },
ctx: Context,
cursor: tui.renderer.MouseCursorShape = .pointer,
on_click: ClickHandler = do_nothing,
on_click2: ClickHandler = do_nothing,
@ -156,7 +157,7 @@ fn State(ctx_type: type) type {
tui.need_render(@src());
return true;
} else if (try m.match(.{ "H", tp.extract(&self.hover) })) {
tui.rdr().request_mouse_cursor_pointer(self.hover);
tui.rdr().request_mouse_cursor(self.opts.cursor, self.hover);
tui.need_render(@src());
return true;
}