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.
17 #include "frontends/key_state.h"
19 #include <boost/shared_ptr.hpp>
21 #include "support/std_string.h"
27 /// Defines key maps and actions for key sequences
31 * Bind a key sequence to an action.
32 * @return 0 on success, or position in string seq where error
34 * See kb_sequence::parse for the syntax of the seq string
36 string::size_type bind(string const & seq, int action);
39 bool kb_keymap::read(string const & bind_file);
41 /// print all available keysyms
42 string const print() const;
45 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
47 * Look up a key press in the keymap.
48 * @param key the keysym
49 * @param mod the modifiers
50 * @param seq the current key sequence so far
51 * @return the action / LFUN_PREFIX / LFUN_UNKNOWN_ACTION
53 int lookup(LyXKeySymPtr key,
54 key_modifier::state mod, kb_sequence * seq) const;
56 /// Given an action, find all keybindings.
57 string const findbinding(int action,
58 string const & prefix = string()) const;
61 * Returns a string of the given keysym, with modifiers.
62 * @param key the key as a keysym
63 * @param mod the modifiers
65 static string const printKeysym(LyXKeySymPtr key,
66 key_modifier::state mod);
68 typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
79 /// Keymap for prefix keys
80 boost::shared_ptr<kb_keymap> table;
82 /// Action for !prefix keys
87 * Define an action for a key sequence.
88 * @param r internal recursion level
90 void defkey(kb_sequence * seq, int action, unsigned int r = 0);
92 /// Returns a string of the given key
93 string const printKey(kb_key const & key) const;
95 /// is the table empty ?
100 typedef std::vector<kb_key> Table;