4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
11 * Full author contact details are available in file CREDITS.
18 #include "frontends/key_state.h"
19 #include "frontends/LyXKeySym.h"
25 /// Defines key maps and actions for key sequences
29 * Bind a key sequence to an action.
30 * @return 0 on success, or position in string seq where error
32 * See kb_sequence::parse for the syntax of the seq string
34 string::size_type bind(string const & seq, int action);
37 bool kb_keymap::read(string const & bind_file);
39 /// print all available keysyms
40 string const print() const;
43 * Look up a key press in the keymap.
44 * @param key the keysym
45 * @param mod the modifiers
46 * @param seq the current key sequence so far
47 * @return the action / LFUN_PREFIX / LFUN_UNKNOWN_ACTION
49 int lookup(LyXKeySymPtr key,
50 key_modifier::state mod, kb_sequence * seq) const;
52 /// Given an action, find all keybindings.
53 string const findbinding(int action,
54 string const & prefix = string()) const;
57 * Returns a string of the given keysym, with modifiers.
58 * @param key the key as a keysym
59 * @param mod the modifiers
61 static string const printKeysym(LyXKeySymPtr key,
62 key_modifier::state mod);
64 typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
75 /// Keymap for prefix keys
76 boost::shared_ptr<kb_keymap> table;
78 /// Action for !prefix keys
83 * Define an action for a key sequence.
84 * @param r internal recursion level
86 void defkey(kb_sequence * seq, int action, unsigned int r = 0);
88 /// Returns a string of the given key
89 string const printKey(kb_key const & key) const;
91 /// is the table empty ?
96 typedef std::vector<kb_key> Table;