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>
19 #include "frontends/key_state.h"
20 #include "frontends/LyXKeySym.h"
26 /// Defines key maps and actions for key sequences
30 * Bind a key sequence to an action.
31 * @return 0 on success, or position in string seq where error
33 * See kb_sequence::parse for the syntax of the seq string
35 string::size_type bind(string const & seq, int action);
37 /// print all available keysyms
38 string const print() const;
41 * Look up a key press in the keymap.
42 * @param key the keysym
43 * @param mod the modifiers
44 * @param seq the current key sequence so far
45 * @return the action / LFUN_PREFIX / LFUN_UNKNOWN_ACTION
47 int lookup(LyXKeySymPtr key,
48 key_modifier::state mod, kb_sequence * seq) const;
50 /// Given an action, find all keybindings.
51 string const findbinding(int action,
52 string const & prefix = string()) const;
55 * Returns a string of the given keysym, with modifiers.
56 * @param key the key as a keysym
57 * @param mod the modifiers
59 static string const printKeysym(LyXKeySymPtr key,
60 key_modifier::state mod);
62 typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
73 /// Keymap for prefix keys
74 boost::shared_ptr<kb_keymap> table;
76 /// Action for !prefix keys
81 * Define an action for a key sequence.
82 * @param r internal recursion level
84 void defkey(kb_sequence * seq, int action, unsigned int r = 0);
86 /// Returns a string of the given key
87 string const printKey(kb_key const & key) const;
89 /// is the table empty ?
94 typedef std::list<kb_key> Table;