]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXKeySym.h
*duck*
[lyx.git] / src / frontends / LyXKeySym.h
1 // -*- C++ -*-
2 /**
3  * \file LyXKeySym.h
4  * Copyright 2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author Asger and Juergen
8  */
9
10 #ifndef LYXKEYSYM_H
11 #define LYXKEYSYM_H
12
13 #ifdef __GNUG__
14 #pragma interface
15 #endif
16
17 #include "LString.h"
18 #include <boost/shared_ptr.hpp>
19
20 /**
21  * This is a base class for representing a keypress.
22  * Each frontend has to implement this to provide
23  * the functionality that LyX needs in regards to
24  * key presses.
25  */
26 class LyXKeySym {
27 public:
28         LyXKeySym() {}
29
30         virtual ~LyXKeySym() {}
31
32         /// Initialize with the name of a key. F. ex. "space" or "a"
33         virtual void init(string const & symbolname) = 0;
34
35         /// Is this a valid key?
36         virtual bool isOK() const = 0;
37
38         /// Is this a modifier key only?
39         virtual bool isModifier() const = 0;
40
41         /// What is the symbolic name of this key? F.ex. "Return" or "c"
42         virtual 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() const = 0;
50
51         /**
52          * We need to be able to equality compare these for the
53          * sake of the keymap business.
54          */
55         virtual bool operator==(LyXKeySym const & k) const = 0;
56 };
57
58 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
59
60 #endif