pub fn keymap<T>(
info: CallbackInfo<'_>,
events: &[(Vec<AcceleratorKey>, CallbackType)],
) -> UpdateScreen
Expand description
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:
ⓘ
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],
])
}