use crate::IntoFFI;
use crate::reactive::WuiComputed;
use waterui::cursor::{Cursor, CursorStyle};
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub enum WuiCursorStyle {
Arrow = 0,
PointingHand = 1,
IBeam = 2,
Crosshair = 3,
OpenHand = 4,
ClosedHand = 5,
NotAllowed = 6,
ResizeLeft = 7,
ResizeRight = 8,
ResizeUp = 9,
ResizeDown = 10,
ResizeLeftRight = 11,
ResizeUpDown = 12,
Move = 13,
Wait = 14,
Copy = 15,
}
impl IntoFFI for CursorStyle {
type FFI = WuiCursorStyle;
fn into_ffi(self) -> Self::FFI {
match self {
Self::Arrow => WuiCursorStyle::Arrow,
Self::PointingHand => WuiCursorStyle::PointingHand,
Self::IBeam => WuiCursorStyle::IBeam,
Self::Crosshair => WuiCursorStyle::Crosshair,
Self::OpenHand => WuiCursorStyle::OpenHand,
Self::ClosedHand => WuiCursorStyle::ClosedHand,
Self::NotAllowed => WuiCursorStyle::NotAllowed,
Self::ResizeLeft => WuiCursorStyle::ResizeLeft,
Self::ResizeRight => WuiCursorStyle::ResizeRight,
Self::ResizeUp => WuiCursorStyle::ResizeUp,
Self::ResizeDown => WuiCursorStyle::ResizeDown,
Self::ResizeLeftRight => WuiCursorStyle::ResizeLeftRight,
Self::ResizeUpDown => WuiCursorStyle::ResizeUpDown,
Self::Move => WuiCursorStyle::Move,
Self::Wait => WuiCursorStyle::Wait,
Self::Copy => WuiCursorStyle::Copy,
_ => panic!("unsupported CursorStyle variant for FFI"),
}
}
}
#[repr(C)]
#[derive(Debug)]
pub struct WuiCursor {
pub style: *mut WuiComputed<CursorStyle>,
}
impl IntoFFI for Cursor {
type FFI = WuiCursor;
fn into_ffi(self) -> Self::FFI {
WuiCursor {
style: self.style.into_ffi(),
}
}
}
crate::ffi_computed!(CursorStyle, WuiCursorStyle, cursor_style);