4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
7 * \author Lars Gullik Bjønnes <larsbj@lyx.org>
8 * \author John Levon <moz@compsoc.man.ac.uk>
15 #include "frontends/key_state.h"
16 #include "frontends/LyXKeySym.h"
22 /// Defines key maps and actions for key sequences
26 * Bind a key sequence to an action.
27 * @return 0 on success, or position in string seq where error
29 * See kb_sequence::parse for the syntax of the seq string
31 string::size_type bind(string const & seq, int action);
33 /// print all available keysyms
34 string const print() const;
37 * Look up a key press in the keymap.
38 * @param key the keysym
39 * @param mod the modifiers
40 * @param seq the current key sequence so far
41 * @return the action / LFUN_PREFIX / LFUN_UNKNOWN_ACTION
43 int lookup(LyXKeySymPtr key,
44 key_modifier::state mod, kb_sequence * seq) const;
46 /// Given an action, find all keybindings.
47 string const findbinding(int action,
48 string const & prefix = string()) const;
51 * Returns a string of the given keysym, with modifiers.
52 * @param key the key as a keysym
53 * @param mod the modifiers
55 static string const printKeysym(LyXKeySymPtr key,
56 key_modifier::state mod);
58 typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
69 /// Keymap for prefix keys
70 boost::shared_ptr<kb_keymap> table;
72 /// Action for !prefix keys
77 * Define an action for a key sequence.
78 * @param r internal recursion level
80 void defkey(kb_sequence * seq, int action, unsigned int r = 0);
82 /// Returns a string of the given key
83 string const printKey(kb_key const & key) const;
85 /// is the table empty ?
90 typedef std::list<kb_key> Table;