use crate::app_state::with_app_state;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum CursorIcon {
#[default]
Default,
Text,
Pointer,
Crosshair,
Move,
NotAllowed,
Grab,
Grabbing,
ResizeNorth,
ResizeSouth,
ResizeEast,
ResizeWest,
ResizeNorthEast,
ResizeNorthWest,
ResizeSouthEast,
ResizeSouthWest,
ColResize,
RowResize,
Wait,
Progress,
}
pub fn set_cursor(cursor: CursorIcon) {
with_app_state(|app| {
if app.current_cursor.replace(cursor) == cursor {
return;
}
app.outgoing_cursor.set(cursor);
});
}
pub fn take_cursor_change() -> Option<CursorIcon> {
with_app_state(|app| app.outgoing_cursor.take())
}
pub fn get_current_cursor() -> CursorIcon {
with_app_state(|app| app.current_cursor.get())
}