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