use crate::*;
pub(crate) struct NativeEventCallbackInner {
pub(crate) callback: Box<dyn FnMut(NativeEvent)>,
}
#[derive(CustomDebug)]
pub struct NativeEventHandler {
pub(crate) event_name: String,
#[debug(skip)]
pub(crate) callback: *mut NativeEventCallbackInner,
}
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct NativeMouseEvent {
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) client_x: i32,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) client_y: i32,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) screen_x: i32,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) screen_y: i32,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) button: i16,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) buttons: u16,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) ctrl_key: bool,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) shift_key: bool,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) alt_key: bool,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) meta_key: bool,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct NativeInputEvent {
#[get(pub)]
#[set(pub)]
value: String,
#[get(pub)]
#[set(pub)]
input_type: String,
}
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct NativeKeyboardEvent {
#[get(pub)]
#[set(pub)]
pub(crate) key: String,
#[get(pub)]
#[set(pub)]
pub(crate) code: String,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) location: u32,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) ctrl_key: bool,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) shift_key: bool,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) alt_key: bool,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) meta_key: bool,
#[get(pub, type(copy))]
#[set(pub)]
pub(crate) repeat: bool,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct NativeFocusEvent {
#[get(pub, type(copy))]
#[set(pub)]
is_focus: bool,
#[get(pub, type(copy))]
#[set(pub)]
is_blur: bool,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct NativeSubmitEvent {
#[get(pub)]
#[set(pub)]
submitter: Option<String>,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct NativeChangeEvent {
#[get(pub)]
#[set(pub)]
value: String,
#[get(pub, type(copy))]
#[set(pub)]
checked: bool,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct NativeDragEvent {
#[get(pub, type(copy))]
#[set(pub)]
client_x: i32,
#[get(pub, type(copy))]
#[set(pub)]
client_y: i32,
#[get(pub)]
#[set(pub)]
types: Vec<String>,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct NativeTouchEvent {
#[get(pub, type(copy))]
#[set(pub)]
touches_count: u32,
#[get(pub, type(copy))]
#[set(pub)]
client_x: i32,
#[get(pub, type(copy))]
#[set(pub)]
client_y: i32,
}
#[derive(Clone, Data, Debug, Default, New, PartialEq)]
pub struct NativeWheelEvent {
#[get(pub, type(copy))]
#[set(pub)]
delta_x: f64,
#[get(pub, type(copy))]
#[set(pub)]
delta_y: f64,
#[get(pub, type(copy))]
#[set(pub)]
delta_mode: u32,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct NativeClipboardEvent {
#[get(pub)]
#[set(pub)]
data: Option<String>,
}
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct NativeMediaEvent {
#[get(pub)]
#[set(pub)]
event_type: String,
}