]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXKeySym.h
some tabular fixes for the problems reported by Helge
[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 #include "key_state.h"
18
19 /**
20  * This is a base class for representing a keypress.
21  * Each frontend has to implement this to provide
22  * the functionality that LyX needs in regards to
23  * key presses.
24  */
25 class LyXKeySym {
26 public:
27         LyXKeySym() {}
28
29         virtual ~LyXKeySym() {}
30
31         /// Initialize with the name of a key. F. ex. "space" or "a"
32         virtual void init(std::string const & symbolname) = 0;
33
34         /// Is this a valid key?
35         virtual bool isOK() const = 0;
36
37         /// Is this a modifier key only?
38         virtual bool isModifier() const = 0;
39
40         /// Is this normal insertable text ? (last ditch attempt only)
41         virtual bool isText() const { return false; }
42
43         /// What is the symbolic name of this key? F.ex. "Return" or "c"
44         virtual std::string getSymbolName() const = 0;
45
46         /**
47          * Return the value of the keysym into the local ISO encoding.
48          * This converts the LyXKeySym to a 8-bit encoded character.
49          * This relies on user to use the right encoding.
50          */
51         virtual char getISOEncoded(std::string const & encoding) const = 0;
52
53         /**
54          * Return a string describing the KeySym with modifier mod.
55          * This should use the native UI format when applicable
56          */
57         virtual std::string const print(key_modifier::state mod) const = 0;
58 };
59
60
61 /**
62  * We need to be able to equality compare these for the
63  * sake of the keymap business.
64  */
65 bool operator==(LyXKeySym const & k1, LyXKeySym const & k2);
66
67 #endif