[−][src]Function azul_core::window_state::keymap
pub fn keymap<T>(
info: CallbackInfo,
events: &[(Vec<AcceleratorKey>, CallbackType)]
) -> UpdateScreen
Utility function that, given the current keyboard state and a list of keyboard accelerators + callbacks, checks what callback can be invoked and the first matching callback. This leads to very readable (but still type checked) code like this:
ⓘThis example is not tested
use azul::prelude::{AcceleratorKey::*, VirtualKeyCode::*}; fn my_Callback(info: CallbackInfo) -> UpdateScreen { keymap(info, &[ [vec![Ctrl, S], save_document], [vec![Ctrl, N], create_new_document], [vec![Ctrl, O], open_new_file], [vec![Ctrl, Shift, N], create_new_window], ]) }