use crate::pointer::{PointerButton, PointerProperties};
use crate::{KeyProperties, WheelDelta};
use keyboard_types::Modifiers;
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PointerDown {
pointer: PointerProperties,
modifiers: Modifiers,
button_pressed: PointerButton,
click_count: i64,
}
impl PointerDown {
pub fn new(
pointer: PointerProperties,
modifiers: Modifiers,
button_pressed: PointerButton,
click_count: i64,
) -> Self {
Self {
pointer,
modifiers,
button_pressed,
click_count,
}
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn button_pressed(&self) -> &PointerButton {
&self.button_pressed
}
pub fn click_count(&self) -> i64 {
self.click_count
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PointerUp {
pointer: PointerProperties,
modifiers: Modifiers,
button_released: PointerButton,
click_count: i64,
}
impl PointerUp {
pub fn new(
pointer: PointerProperties,
modifiers: Modifiers,
button_released: PointerButton,
click_count: i64,
) -> Self {
Self {
pointer,
modifiers,
button_released,
click_count,
}
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
pub fn button_released(&self) -> &PointerButton {
&self.button_released
}
pub fn click_count(&self) -> i64 {
self.click_count
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PointerEnter {
pointer: PointerProperties,
modifiers: Modifiers,
}
impl PointerEnter {
pub fn new(pointer: PointerProperties, modifiers: Modifiers) -> Self {
Self { pointer, modifiers }
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PointerLeave {
pointer: PointerProperties,
modifiers: Modifiers,
}
impl PointerLeave {
pub fn new(pointer: PointerProperties, modifiers: Modifiers) -> Self {
Self { pointer, modifiers }
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PointerMove {
pointer: PointerProperties,
modifiers: Modifiers,
}
impl PointerMove {
pub fn new(pointer: PointerProperties, modifiers: Modifiers) -> Self {
Self { pointer, modifiers }
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PointerCancel {
pointer: PointerProperties,
modifiers: Modifiers,
}
impl PointerCancel {
pub fn new(pointer: PointerProperties, modifiers: Modifiers) -> Self {
Self { pointer, modifiers }
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PrimaryClick {
pointer: PointerProperties,
modifiers: Modifiers,
click_count: i64,
}
impl PrimaryClick {
pub fn new(pointer: PointerProperties, modifiers: Modifiers, click_count: i64) -> Self {
Self {
pointer,
modifiers,
click_count,
}
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn click_count(&self) -> i64 {
self.click_count
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DoubleClick {
pointer: PointerProperties,
modifiers: Modifiers,
click_count: i64,
}
impl DoubleClick {
pub fn new(pointer: PointerProperties, modifiers: Modifiers, click_count: i64) -> Self {
Self {
pointer,
modifiers,
click_count,
}
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn click_count(&self) -> i64 {
self.click_count
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AuxiliaryClick {
pointer: PointerProperties,
modifiers: Modifiers,
clicked_button: PointerButton,
click_count: i64,
}
impl AuxiliaryClick {
pub fn new(
pointer: PointerProperties,
modifiers: Modifiers,
clicked_button: PointerButton,
click_count: i64,
) -> Self {
Self {
pointer,
modifiers,
clicked_button,
click_count,
}
}
pub fn pointer(&self) -> &PointerProperties {
&self.pointer
}
pub fn clicked_button(&self) -> &PointerButton {
&self.clicked_button
}
pub fn click_count(&self) -> i64 {
self.click_count
}
pub fn modifiers(&self) -> Modifiers {
self.modifiers
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct KeyDown {
key: KeyProperties,
}
impl KeyDown {
pub fn new(key: KeyProperties) -> Self {
Self { key }
}
pub fn key(&self) -> &KeyProperties {
&self.key
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct KeyUp {
key: KeyProperties,
}
impl KeyUp {
pub fn new(key: KeyProperties) -> Self {
Self { key }
}
pub fn key(&self) -> &KeyProperties {
&self.key
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct KeyTyped {
key: KeyProperties,
}
impl KeyTyped {
pub fn new(key: KeyProperties) -> Self {
Self { key }
}
pub fn key(&self) -> &KeyProperties {
&self.key
}
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WheelMove {
delta: WheelDelta,
}
impl WheelMove {
pub fn new(delta: WheelDelta) -> Self {
Self { delta }
}
pub fn delta(&self) -> WheelDelta {
self.delta
}
}