4 * Copyright 2001 the LyX Team
5 * Read the file COPYING
13 #include "frontends/key_state.h"
14 #include "frontends/LyXKeySym.h"
20 /// Holds a key sequence and the current and standard keymaps
23 typedef std::vector<LyXKeySymPtr> KeySequence;
25 friend class kb_keymap;
28 kb_sequence(kb_keymap * std, kb_keymap * cur)
29 : stdmap(std), curmap(cur), deleted_(false) {}
32 * Add a key to the key sequence and look it up in the curmap
33 * if the latter is defined.
34 * @param keysym the key to add
35 * @param mod modifier mask
36 * @param nmod which modifiers to mask out for equality test
37 * @return the action matching this key sequence or LFUN_UNKNOWN_ACTION
39 int addkey(LyXKeySymPtr keysym, key_modifier::state mod,
40 key_modifier::state nmod = key_modifier::none);
43 * Add a sequence of keys from a string to the sequence
44 * @return string::npos if OK, else error position in string
46 * Keys in the string must be separated with whitespace;
47 * Use the keysym names used by XStringToKeysym, f.ex.
48 * "Space", "a", "Return", ...
49 * Prefixes are S-, C-, M- for shift, control, meta
50 * Prefixes can also be ignored by using the Tilde "~"
53 string::size_type parse(string const & s);
56 * Return the current sequence as a string.
59 string const print() const;
62 * Return the current sequence and available options as
63 * a string. No options are added if no curmap kb map exists.
65 string const printOptions() const;
67 /// Mark the sequence as deleted.
70 /// Reset sequence to become "deleted"
76 bool deleted() const {
80 /// length of sequence
81 KeySequence::size_type length() const {
82 return sequence.size();
85 /// Keymap to use if a new sequence is starting
88 /// Keymap to use for the next key
93 * Array holding the current key sequence as KeySyms.
94 * If sequence[length - 1] < 0xff it can be used as ISO8859 char
98 typedef std::pair<key_modifier::state, key_modifier::state>
101 /// modifiers for keys in the sequence
102 std::vector<modifier_pair> modifiers;
104 /// is keysequence deleted ?