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"
21 #include <boost/shared_ptr.hpp>
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
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(unsigned int 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.
57 * @param mod the modifiers
59 static string const printKeysym(unsigned int key, key_modifier::state mod);
61 /// return the ISO value of a keysym
62 static char getiso(unsigned int i);
65 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
84 * Define an action for a key sequence.
85 * @param r internal recursion level
87 void defkey(kb_sequence * seq, int action, unsigned int r = 0);
89 /// Returns a string of the given key
90 string const printKey(kb_key const & key) const;
92 /// is the table empty ?
97 typedef std::list<kb_key> Table;