2023-09-04 22:27:34 -04:00
|
|
|
import Gdk from 'gi://Gdk';
|
|
|
|
const display = Gdk.Display.get_default();
|
|
|
|
|
2023-09-11 19:28:22 -04:00
|
|
|
export const EventBox = ({ reset = true, ...params }) => ags.Widget.EventBox({
|
2023-09-04 22:27:34 -04:00
|
|
|
...params,
|
|
|
|
onHover: box => {
|
2023-09-11 15:55:16 -04:00
|
|
|
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'));
|
|
|
|
}
|
2023-09-04 22:27:34 -04:00
|
|
|
},
|
|
|
|
onHoverLost: box => {
|
2023-09-11 19:28:22 -04:00
|
|
|
if (reset)
|
|
|
|
box.window.set_cursor(null);
|
2023-09-04 22:27:34 -04:00
|
|
|
},
|
|
|
|
});
|