]> git.lyx.org Git - lyx.git/blob - src/kbsequence.h
small things to preferences, add some const remove commented code
[lyx.git] / src / kbsequence.h
1 // -*- C++ -*-
2 /* ======================================================================= *\
3    File   : kbmap.h, kbmap.h,v 1.3 1996/12/10 04:35:57 larsbj Exp
4    Author : chb, 30.Oct.1995
5    Docu   : see kbmap.C
6    Purpose: class definitions for XKeyEvent keymap handling
7    \* ==================================================================== */
8
9 #ifndef KBSEQUENCE_H
10 #define KBSEQUENCE_H
11
12 #ifdef __GNUG__
13 #pragma interface
14 #endif
15
16 #include <vector>
17 #include "LString.h"
18
19 class kb_keymap;
20
21 /// Holds a key sequence and the current and standard keymaps
22 class kb_sequence {
23 public:
24         ///
25         kb_sequence() {
26                 stdmap = curmap = 0;
27                 length = 0;
28         }
29
30         /** Add a key to the key sequence and look it up in the curmap
31             if the latter is defined. */
32         int addkey(unsigned int key, unsigned int mod, unsigned int nmod = 0);
33
34         ///
35         int print(string & buf, bool when_defined = false) const;
36         
37         ///
38         int printOptions(string & buf) const;
39         
40         /// Make length negative to mark the sequence as deleted
41         void delseq();
42         
43         ///
44         char getiso() const;
45         
46         ///
47         unsigned int getsym() const;
48         
49         ///
50         void reset();
51         
52         ///
53         int parse(string const & s);
54         
55         /// Keymap to use if a new sequence is starting
56         kb_keymap * stdmap;
57         
58         /// Keymap to use for the next key
59         kb_keymap * curmap;
60         
61         /** Array holding the current key sequence.
62             If sequence[length-1] < 0xff it can be used as ISO8859 char */
63         std::vector<unsigned int> sequence;
64         
65         ///
66         std::vector<unsigned int> modifiers;
67         
68         /// Current length of key sequence
69         int length;
70 };
71
72 #endif