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"
25 /// Holds a key sequence and the current and standard keymaps
28 typedef std::vector<LyXKeySymPtr> KeySequence;
30 friend class kb_keymap;
33 kb_sequence(kb_keymap * std, kb_keymap * cur)
34 : stdmap(std), curmap(cur), deleted_(false) {}
37 * Add a key to the key sequence and look it up in the curmap
38 * if the latter is defined.
39 * @param keysym the key to add
40 * @param mod modifier mask
41 * @param nmod which modifiers to mask out for equality test
42 * @return the action matching this key sequence or LFUN_UNKNOWN_ACTION
45 addkey(LyXKeySymPtr keysym, key_modifier::state mod,
46 key_modifier::state nmod = key_modifier::none);
49 * Add a sequence of keys from a string to the sequence
50 * @return string::npos if OK, else error position in string
52 * Keys in the string must be separated with whitespace;
53 * Use the keysym names used by XStringToKeysym, f.ex.
54 * "Space", "a", "Return", ...
55 * Prefixes are S-, C-, M- for shift, control, meta
56 * Prefixes can also be ignored by using the Tilde "~"
59 std::string::size_type parse(std::string const & s);
62 * Return the current sequence as a string.
65 std::string const print() const;
68 * Return the current sequence and available options as
69 * a string. No options are added if no curmap kb map exists.
71 std::string const printOptions() const;
73 /// Mark the sequence as deleted.
76 /// Reset sequence to become "deleted"
82 bool deleted() const {
86 /// length of sequence
87 KeySequence::size_type length() const {
88 return sequence.size();
91 /// Keymap to use if a new sequence is starting
94 /// Keymap to use for the next key
99 * Array holding the current key sequence as KeySyms.
100 * If sequence[length - 1] < 0xff it can be used as ISO8859 char
102 KeySequence sequence;
104 typedef std::pair<key_modifier::state, key_modifier::state>
107 /// modifiers for keys in the sequence
108 std::vector<modifier_pair> modifiers;
110 /// is keysequence deleted ?