#![allow(unused, missing_docs)]
use crate::{ConstInit, impl_trait, is, set};
#[doc = crate::_tags!(interaction member)]
#[doc = crate::_doc_meta!{location("ui/event")}]
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[allow(missing_docs)]
pub enum KeyMod {
LeftShift,
LeftControl,
LeftAlt,
LeftSuper,
RightShift,
RightControl,
RightAlt,
RightSuper,
AltGr,
IsoLevel5Shift,
}
impl ConstInit for KeyMod {
const INIT: Self = Self::LeftShift;
}
#[allow(non_upper_case_globals)]
impl KeyMod {
pub const IsoLevel3Shift: KeyMod = KeyMod::AltGr;
}
set! {
#[doc = crate::_tags!(interaction set)]
#[doc = crate::_doc_meta!{
location("ui/event"),
test_size_of(KeyMods = 2|16), // option = 4|32
}]
#[repr(transparent)]
pub struct KeyMods(u16) {
CONTROL = 0;
SHIFT = 1;
ALT = 2;
SUPER = 3;
ALT_GR = 4;
CAPS_LOCK = 5;
NUM_LOCK = 6;
SCROLL_LOCK = 7;
LEVEL5 = 8;
REPEATING = 9;
COMPOSING = 10;
}
traits(!Debug);
}
impl_trait! { fmt::Debug for KeyMods |self, f| {
let c = is![self.has_control(), "C", "-"];
let s = is![self.has_shift(), "S", "-"];
let a = is![self.has_alt(), "A", "-"];
let g = is![self.has_alt_gr(), "G", "-"];
let u = is![self.has_super(), "U", "-"];
let l = is![self.has_caps_lock(), "L", "-"];
let n = is![self.has_num_lock(), "N", "-"];
let r = is![self.has_repeating(), "R", "-"];
let p = is![self.has_composing(), "P", "-"];
write![f, "{c}{s}{a}{g}{u}{l}{n}{r}{p}"]
} }