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);
34 bool kb_keymap::read(string const & bind_file);
36 /// print all available keysyms
37 string const print() const;
40 * Look up a key press in the keymap.
41 * @param key the keysym
42 * @param mod the modifiers
43 * @param seq the current key sequence so far
44 * @return the action / LFUN_PREFIX / LFUN_UNKNOWN_ACTION
46 int lookup(LyXKeySymPtr key,
47 key_modifier::state mod, kb_sequence * seq) const;
49 /// Given an action, find all keybindings.
50 string const findbinding(int action,
51 string const & prefix = string()) const;
54 * Returns a string of the given keysym, with modifiers.
55 * @param key the key as a keysym
56 * @param mod the modifiers
58 static string const printKeysym(LyXKeySymPtr key,
59 key_modifier::state mod);
61 typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
72 /// Keymap for prefix keys
73 boost::shared_ptr<kb_keymap> table;
75 /// Action for !prefix keys
80 * Define an action for a key sequence.
81 * @param r internal recursion level
83 void defkey(kb_sequence * seq, int action, unsigned int r = 0);
85 /// Returns a string of the given key
86 string const printKey(kb_key const & key) const;
88 /// is the table empty ?
93 typedef std::vector<kb_key> Table;