1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use super::*;

#[derive(Debug, Clone)]
pub enum Event {
	MouseMove { at: Vec2, state: Mod },
	MouseButton { button: Click, state: Mod },
	Scroll { at: Vec2, state: Mod },
	Keyboard { key: Key, state: Mod },
	Char { ch: char },
	OfferFocus,
	Defocus,
}

#[derive(Debug, Clone)]
pub enum EventReply {
	Accept,
	Reject,
	Decline,
	DropFocus,
}

bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Mod: u32 {
	const PRESS = 0x1;
	const REPEAT = 0x2;
	const RELEASE = 0x4;
	const SHIFT = 0x10;
	const CTRL = 0x20;
	const ALT = 0x40;
	const WIN = 0x80;
	const LEFT = 0x100;
	const MID = 0x200;
	const RIGHT = 0x400;
}
}
impl Mod {
	pub fn pressed(&self) -> bool {
		self.intersects(Mod::PRESS | Mod::REPEAT)
	}
	pub fn released(&self) -> bool {
		self.contains(Mod::RELEASE)
	}
	pub fn ctrl(&self) -> bool {
		self.contains(Mod::CTRL)
	}
	pub fn shift(&self) -> bool {
		self.contains(Mod::SHIFT)
	}
	pub fn alt(&self) -> bool {
		self.contains(Mod::ALT)
	}
	pub fn win(&self) -> bool {
		self.contains(Mod::WIN)
	}
	pub fn lmb(&self) -> bool {
		self.contains(Mod::LEFT)
	}
	pub fn mmb(&self) -> bool {
		self.contains(Mod::MID)
	}
	pub fn rmb(&self) -> bool {
		self.contains(Mod::RIGHT)
	}
}

#[derive(Debug, Clone)]
pub enum Click {
	Left,
	Right,
	Middle,
}

pub use glfw::Key;