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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct NcMiceEvents(pub c_api::NcMiceEvents_u32);
impl NcMiceEvents {
pub const None: NcMiceEvents = Self(c_api::NCMICE_NO_EVENTS);
pub const Move: NcMiceEvents = Self(c_api::NCMICE_MOVE_EVENTS);
pub const Button: NcMiceEvents = Self(c_api::NCMICE_BUTTON_EVENTS);
pub const Drag: NcMiceEvents = Self(c_api::NCMICE_DRAG_EVENTS);
pub const All: NcMiceEvents = Self(c_api::NCMICE_ALL_EVENTS);
}
impl NcMiceEvents {
pub fn new(value: c_api::NcMiceEvents_u32) -> Self {
Self(value)
}
pub fn has(&self, other: NcMiceEvents) -> bool {
(self.0 & other.0) == other.0
}
pub fn add(&mut self, other: NcMiceEvents) {
self.0 |= other.0
}
}
mod std_impl {
use super::{c_api::NcMiceEvents_u32, NcMiceEvents};
impl Default for NcMiceEvents {
fn default() -> Self {
Self::None
}
}
crate::from_primitive![NcMiceEvents, NcMiceEvents_u32];
crate::unit_impl_from![NcMiceEvents, NcMiceEvents_u32];
crate::unit_impl_ops![bitwise; NcMiceEvents, NcMiceEvents_u32];
crate::unit_impl_fmt![bases+display; NcMiceEvents];
}
pub(crate) mod c_api {
use crate::c_api::ffi;
pub type NcMiceEvents_u32 = u32;
pub const NCMICE_NO_EVENTS: NcMiceEvents_u32 = ffi::NCMICE_NO_EVENTS;
pub const NCMICE_MOVE_EVENTS: NcMiceEvents_u32 = ffi::NCMICE_MOVE_EVENT;
pub const NCMICE_BUTTON_EVENTS: NcMiceEvents_u32 = ffi::NCMICE_BUTTON_EVENT;
pub const NCMICE_DRAG_EVENTS: NcMiceEvents_u32 = ffi::NCMICE_DRAG_EVENT;
pub const NCMICE_ALL_EVENTS: NcMiceEvents_u32 = ffi::NCMICE_ALL_EVENTS;
}