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;
93 if (sequence != staticseq) {
99 /// Add a key to the key sequence and look it up in the curmap
100 /** Add a key to the key sequence and look it up in the curmap
101 if the latter is defined. */
102 int addkey(unsigned long key, unsigned mod, unsigned nmod = 0);
105 int print(string & buf, bool when_defined = false) const;
108 int printOptions(string & buf) const;
110 /// Make length negative to mark the sequence as deleted
117 unsigned long getsym();
123 int parse(char const * s);
125 /// Keymap to use if a new sequence is starting
128 /// Keymap to use for the next key
131 /// Array holding the current key sequence
132 /** If sequence[length-1] < 0xff it can be used as ISO8859 char */
133 unsigned int * sequence;
136 unsigned int * modifiers;
138 /// Current length of key sequence
142 /// Static array preallocated for sequence
143 unsigned int staticseq[KB_PREALLOC];
146 unsigned int staticmod[KB_PREALLOC];
148 /// Physically allocated storage size