feat(ags): add button equivalent to cursorbox

This commit is contained in:
matt1432 2023-09-21 19:50:30 -04:00
parent ac0b6fa5c0
commit 4f99d3bb96

View file

@ -16,3 +16,19 @@ export const EventBox = ({ reset = true, ...params }) => ags.Widget.EventBox({
box.window.set_cursor(null); box.window.set_cursor(null);
}, },
}); });
export const Button = ({ reset = true, ...params }) => ags.Widget.Button({
...params,
onHover: box => {
if (! box.child.sensitive || ! box.sensitive) {
box.window.set_cursor(Gdk.Cursor.new_from_name(display, 'not-allowed'));
}
else {
box.window.set_cursor(Gdk.Cursor.new_from_name(display, 'pointer'));
}
},
onHoverLost: box => {
if (reset)
box.window.set_cursor(null);
},
});