Function gtk4::accelerator_parse
source · pub fn accelerator_parse(accelerator: &str) -> Option<(Key, ModifierType)>
Expand description
Parses a string representing an accelerator.
The format looks like “<Control>a
” or “<Shift><Alt>F1
”.
The parser is fairly liberal and allows lower or upper case, and also
abbreviations such as “<Ctl>
” and “<Ctrl>
”.
Key names are parsed using keyval_from_name()
. For character keys
the name is not the symbol, but the lowercase name, e.g. one would use
“<Ctrl>minus
” instead of “<Ctrl>-
”.
Modifiers are enclosed in angular brackets <>
, and match the
gdk::ModifierType
mask:
<Shift>
forGDK_SHIFT_MASK
<Ctrl>
forGDK_CONTROL_MASK
<Alt>
forGDK_ALT_MASK
<Meta>
forGDK_META_MASK
<Super>
forGDK_SUPER_MASK
<Hyper>
forGDK_HYPER_MASK
If the parse operation fails, @accelerator_key and @accelerator_mods will be set to 0 (zero).
accelerator
string representing an accelerator
Returns
accelerator_key
return location for accelerator keyval
accelerator_mods
return location for accelerator modifier mask