#[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 core_impls {
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;
}