]> git.lyx.org Git - lyx.git/blob - src/kbmap.h
Fix configure bug with gettext
[lyx.git] / src / kbmap.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 KBMAP_H
10 #define KBMAP_H
11
12 #ifdef __GNUG__
13 #pragma interface
14 #endif
15
16 #include <list>
17 using std::list;
18
19 #include "LString.h"
20
21 class kb_sequence;
22
23 /// Defines key maps and actions for key sequences
24 class kb_keymap {
25 public:
26         ///
27         ~kb_keymap();
28         
29         /** Bind a key-sequence to an action.
30             Returns 0 on success. Otherwise, position in string where
31             error occured. */
32         int bind(char const * seq, int action);
33
34         ///
35         void print(string & buf) const;
36         
37         /// Look up a key in the keymap
38         int lookup(unsigned int key,
39                    unsigned int mod, kb_sequence * seq) const;
40
41         /// Given an action, find all keybindings.
42         string findbinding(int action) const;
43 private:
44         ///
45         struct kb_key {
46                 /// Keysym
47                 unsigned int code;
48                 
49                 /// Modifier masks
50                 unsigned int mod;
51                 
52                 /// Keymap for prefix keys
53                 kb_keymap * table;
54                 
55                 /// Action for !prefix keys
56                 int action;
57         };
58
59
60         /// Define a new key sequence
61         int defkey(kb_sequence * seq, int action, int idx = 0);
62         ///
63         static string keyname(kb_key const & k);
64         
65         ///
66         static
67         void printKey(kb_key const & key, string & buf);
68         ///
69         bool empty() const {
70                 return table.empty();
71         }
72         ///
73         typedef list<kb_key> Table;
74         ///
75         Table table;
76 };
77
78 #endif