pub struct EventDecoder<L>where
L: KeyboardLayout,{ /* private fields */ }
Expand description
Converts KeyEvents into Unicode, according to the current Keyboard Layout
Implementations§
Source§impl<L> EventDecoder<L>where
L: KeyboardLayout,
impl<L> EventDecoder<L>where
L: KeyboardLayout,
Sourcepub const fn new(layout: L, handle_ctrl: HandleControl) -> EventDecoder<L>
pub const fn new(layout: L, handle_ctrl: HandleControl) -> EventDecoder<L>
Construct a new event decoder.
Sourcepub fn set_ctrl_handling(&mut self, new_value: HandleControl)
pub fn set_ctrl_handling(&mut self, new_value: HandleControl)
Change the Ctrl key mapping.
Sourcepub const fn get_ctrl_handling(&self) -> HandleControl
pub const fn get_ctrl_handling(&self) -> HandleControl
Get the current Ctrl key mapping.
Sourcepub fn process_keyevent(&mut self, ev: KeyEvent) -> Option<DecodedKey>
pub fn process_keyevent(&mut self, ev: KeyEvent) -> Option<DecodedKey>
Processes a KeyEvent
returned from add_bit
, add_byte
or add_word
and produces a decoded key.
For example, the KeyEvent for pressing the ‘5’ key on your keyboard gives a DecodedKey of unicode character ‘5’, unless the shift key is held in which case you get the unicode character ‘%’.
Sourcepub fn change_layout(&mut self, new_layout: L)
pub fn change_layout(&mut self, new_layout: L)
Change the keyboard layout.
Only useful with layouts::AnyLayout
, otherwise you can only change a
layout for exactly the same layout.