1 /* src/client/keybindings.h
3 * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
4 * or any later version. For details on its copyright, license, and warranties,
5 * see the file NOTICE in the root directory of the PlomRogue source package.
7 * Database of keybindings and functions to read and manipulate it.
13 #include <stdint.h> /* uint8_t, uint16_t */
21 struct Command * command; /* command in command DB to which key is bound */
26 struct KeyBinding * kbs;
27 uint8_t n_of_kbs; /* how many KeyBinding structs are stored below .kbs? */
28 uint8_t select; /* linear list index of keybinding selected for editing */
29 uint8_t edit; /* 1 if currently editing a keybinding, else 0 */
34 /* Return command bound to "keycode" in "kbdb"; NULL if none found. */
35 extern struct Command * get_command_to_keycode(struct KeyBindingDB * kbdb,
38 /* Return human-readable name (of maximum 9 chars) for "keycode" as matched by
39 * ncurses.h; if none is found, return "(unknown)".
41 extern char * get_keyname_to_keycode(uint16_t keycode);
43 /* Mark keybinding in KeybindingDB (char_selected_kb_db()-) selected by "kb_c"
44 * as being edited, get user input to modify it, then unmark it again. Ensure
45 * there are max. three digits in the ASCII string of the kecode read from user.
47 extern void mod_selected_keyb(char kb_c);
49 /* Move .select in KeybindingDB (char-selected_kb_db()-) selected by "kb_c"
50 * upwards ("dir"=="u") or downwards ("dir"=="d") within KeyBindingDB limits.
52 extern void move_keyb_selection(char kb_c, char dir);