4 * Copyright 2001 the LyX Team
5 * Read the file COPYING
17 #include "frontends/key_state.h"
24 /// Holds a key sequence and the current and standard keymaps
27 friend class kb_keymap;
30 kb_sequence(kb_keymap * std, kb_keymap * cur)
31 : stdmap(std), curmap(cur), length_(0), deleted_(false) {}
36 * Add a key to the key sequence and look it up in the curmap
37 * if the latter is defined.
38 * @param text the text from the key event
39 * @param mod modifier mask
40 * @param nmod which modifiers to mask out for equality test
41 * @return the action matching this key sequence or LFUN_UNKNOWN_ACTION
43 int addkey(unsigned int text, key_modifier::state mod,
44 key_modifier::state nmod = key_modifier::none);
47 * Add a sequence of keys from a string to the sequence
48 * @return string::npos if OK, else error position in string
50 * Keys in the string must be separated with whitespace;
51 * Use the keysym names used by XStringToKeysym
52 * Prefixes are S-, C-, M- for shift, control, meta
54 string::size_type parse(string const & s);
57 * Return the current sequence as a string.
60 string const print() const;
63 * Return the current sequence and available options as
64 * a string. No options are added if no curmap kb map exists.
66 string const printOptions() const;
68 /// Mark the sequence as deleted.
71 /// Return the ISO value of the last keysym in sequence, or 0
74 /// Reset sequence to become "deleted"
80 bool deleted() const {
84 /// length of sequence
85 std::vector<unsigned int>::size_type length() const {
89 /// Keymap to use if a new sequence is starting
92 /// Keymap to use for the next key
96 /// get the keysym of last in sequence
97 unsigned int getsym() const;
100 * Array holding the current key sequence.
101 * If sequence[length-1] < 0xff it can be used as ISO8859 char
103 std::vector<unsigned int> sequence;
105 typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
106 /// modifiers for keys in the sequence
107 std::vector<modifier_pair> modifiers;
109 /// Current length of key sequence
110 std::vector<unsigned int>::size_type length_;
112 /// is keysequence deleted ?