use crate::geometry::Point;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MouseButton {
Left,
Middle,
Right,
Other(u8),
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Modifiers {
pub shift: bool,
pub ctrl: bool,
pub alt: bool,
pub meta: bool,
}
#[derive(Clone, Debug, PartialEq)]
pub enum Key {
Char(char),
Backspace,
Delete,
Insert,
ArrowLeft,
ArrowRight,
ArrowUp,
ArrowDown,
Home,
End,
Tab,
Enter,
Escape,
Other(String),
}
#[derive(Clone, Debug)]
pub enum Event {
MouseMove { pos: Point },
MouseDown { pos: Point, button: MouseButton, modifiers: Modifiers },
MouseUp { pos: Point, button: MouseButton, modifiers: Modifiers },
KeyDown { key: Key, modifiers: Modifiers },
KeyUp { key: Key, modifiers: Modifiers },
FocusGained,
FocusLost,
MouseWheel { pos: Point, delta_y: f64, delta_x: f64 },
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EventResult {
Consumed,
Ignored,
}