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 \* ==================================================================== */
18 #define KB_PREALLOC 16
31 /// Keymap for prefix keys
34 /// Action for !prefix keys
39 /// Defines key maps and actions for key sequences
50 /// Bind a key-sequence to an action
51 /** Returns 0 on success. Otherwise, position in string where
53 int bind(char const * seq, int action);
56 void print(string & buf) const;
58 /// Look up a key in the keymap
59 int lookup(unsigned long key, unsigned mod, kb_sequence * seq);
61 /// Given an action, find all keybindings.
62 string findbinding(int action) const;
64 /// Define a new key sequence
65 int defkey(kb_sequence * seq, int action, int idx = 0);
67 /// Size of the table (<0: hashtab)
70 /// Holds the defined keys
71 /// Table for linear array, table ends with NoSymbol.
76 /// Holds a key sequence and the current and standard keymaps
83 modifiers = staticmod;
94 if (sequence != staticseq) {
100 /// Add a key to the key sequence and look it up in the curmap
101 /** Add a key to the key sequence and look it up in the curmap
102 if the latter is defined. */
103 int addkey(unsigned long key, unsigned mod, unsigned nmod = 0);
106 int print(string & buf, bool when_defined = false) const;
109 int printOptions(string & buf) const;
111 /// Make length negative to mark the sequence as deleted
118 unsigned long getsym();
124 int parse(char const * s);
126 /// Keymap to use if a new sequence is starting
129 /// Keymap to use for the next key
132 /// Array holding the current key sequence
133 /** If sequence[length-1] < 0xff it can be used as ISO8859 char */
134 unsigned int * sequence;
137 unsigned int * modifiers;
139 /// Current length of key sequence
143 /// Static array preallocated for sequence
144 unsigned int staticseq[KB_PREALLOC];
147 unsigned int staticmod[KB_PREALLOC];
149 /// Physically allocated storage size