]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXKeySym.h
Minipage is no more (long live the box inset)
[lyx.git] / src / frontends / LyXKeySym.h
1 // -*- C++ -*-
2 /**
3  * \file LyXKeySym.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Asger and Jürgen
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef LYXKEYSYM_H
13 #define LYXKEYSYM_H
14
15 #include <string>
16
17 /**
18  * This is a base class for representing a keypress.
19  * Each frontend has to implement this to provide
20  * the functionality that LyX needs in regards to
21  * key presses.
22  */
23 class LyXKeySym {
24 public:
25         LyXKeySym() {}
26
27         virtual ~LyXKeySym() {}
28
29         /// Initialize with the name of a key. F. ex. "space" or "a"
30         virtual void init(std::string const & symbolname) = 0;
31
32         /// Is this a valid key?
33         virtual bool isOK() const = 0;
34
35         /// Is this a modifier key only?
36         virtual bool isModifier() const = 0;
37
38         /// Is this normal insertable text ? (last ditch attempt only)
39         virtual bool isText() const { return false; }
40
41         /// What is the symbolic name of this key? F.ex. "Return" or "c"
42         virtual std::string getSymbolName() const = 0;
43
44         /**
45          * Return the value of the keysym into the local ISO encoding.
46          * This converts the LyXKeySym to a 8-bit encoded character.
47          * This relies on user to use the right encoding.
48          */
49         virtual char getISOEncoded(std::string const & encoding) const = 0;
50 };
51
52
53 /**
54  * We need to be able to equality compare these for the
55  * sake of the keymap business.
56  */
57 bool operator==(LyXKeySym const & k1, LyXKeySym const & k2);
58
59 #endif