use crate::geometry::{PhysicalSize, Point, ScaleFactor};
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct WindowId(pub(crate) u64);
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ButtonState {
Pressed,
Released,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PointerButton {
Left,
Right,
Middle,
Other(u16),
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Modifiers {
pub shift: bool,
pub ctrl: bool,
pub alt: bool,
pub meta: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum KeyCode {
Enter,
Escape,
Backspace,
Tab,
Space,
ArrowLeft,
ArrowRight,
ArrowUp,
ArrowDown,
Home,
End,
Delete,
Char(char),
Unidentified(u32),
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ScrollDelta {
pub dx: f64,
pub dy: f64,
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Event {
RedrawRequested,
Resized(PhysicalSize),
ScaleFactorChanged(ScaleFactor),
CloseRequested,
FocusChanged(bool),
PointerMoved { position: Point },
PointerLeft,
PointerButton {
button: PointerButton,
state: ButtonState,
position: Point,
},
Scroll { delta: ScrollDelta },
Key {
code: KeyCode,
state: ButtonState,
modifiers: Modifiers,
},
Text(String),
}