4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
16 #include "frontends/key_state.h"
17 #include "frontends/LyXKeySym.h"
23 /// Holds a key sequence and the current and standard keymaps
26 typedef std::vector<LyXKeySymPtr> KeySequence;
28 friend class kb_keymap;
31 kb_sequence(kb_keymap * std, kb_keymap * cur)
32 : stdmap(std), curmap(cur), deleted_(false) {}
35 * Add a key to the key sequence and look it up in the curmap
36 * if the latter is defined.
37 * @param keysym the key to add
38 * @param mod modifier mask
39 * @param nmod which modifiers to mask out for equality test
40 * @return the action matching this key sequence or LFUN_UNKNOWN_ACTION
42 int addkey(LyXKeySymPtr keysym, key_modifier::state mod,
43 key_modifier::state nmod = key_modifier::none);
46 * Add a sequence of keys from a string to the sequence
47 * @return string::npos if OK, else error position in string
49 * Keys in the string must be separated with whitespace;
50 * Use the keysym names used by XStringToKeysym, f.ex.
51 * "Space", "a", "Return", ...
52 * Prefixes are S-, C-, M- for shift, control, meta
53 * Prefixes can also be ignored by using the Tilde "~"
56 string::size_type parse(string const & s);
59 * Return the current sequence as a string.
62 string const print() const;
65 * Return the current sequence and available options as
66 * a string. No options are added if no curmap kb map exists.
68 string const printOptions() const;
70 /// Mark the sequence as deleted.
73 /// Reset sequence to become "deleted"
79 bool deleted() const {
83 /// length of sequence
84 KeySequence::size_type length() const {
85 return sequence.size();
88 /// Keymap to use if a new sequence is starting
91 /// Keymap to use for the next key
96 * Array holding the current key sequence as KeySyms.
97 * If sequence[length - 1] < 0xff it can be used as ISO8859 char
101 typedef std::pair<key_modifier::state, key_modifier::state>
104 /// modifiers for keys in the sequence
105 std::vector<modifier_pair> modifiers;
107 /// is keysequence deleted ?