2 /* ======================================================================= *\
3 File : kbmap.h, kbmap.h,v 1.3 1996/12/10 04:35:57 larsbj Exp
4 Author : chb, 30.Oct.1995
6 Purpose: class definitions for XKeyEvent keymap handling
7 \* ==================================================================== */
17 #include <boost/smart_ptr.hpp>
23 /// Defines key maps and actions for key sequences
27 * Bind a key sequence to an action.
28 * @return 0 on success, or position in string seq where error
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(unsigned int key,
44 unsigned int 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.
53 * @param mod the modifiers
55 static string const printKeysym(unsigned int key, unsigned int mod);
57 /// return the ISO value of a keysym
58 static char getiso(unsigned int i);
69 /// Keymap for prefix keys
70 boost::shared_ptr<kb_keymap> table;
72 /// Action for !prefix keys
78 * Define an action for a key sequence.
79 * @param r internal recursion level
81 void defkey(kb_sequence * seq, int action, unsigned int r = 0);
83 /// Returns a string of the given key
84 string const printKey(kb_key const & key) const;
86 /// is the table empty ?
91 typedef std::list<kb_key> Table;