]> git.lyx.org Git - lyx.git/blob - src/frontends/LyXKeySym.h
Create a grfx::Loader class and so move large chunks of code out of
[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 #include "LString.h"
14 #include <boost/shared_ptr.hpp>
15
16 /**
17  * This is a base class for representing a keypress.
18  * Each frontend has to implement this to provide
19  * the functionality that LyX needs in regards to
20  * key presses.
21  */
22 class LyXKeySym {
23 public:
24         LyXKeySym() {}
25
26         virtual ~LyXKeySym() {}
27
28         /// Initialize with the name of a key. F. ex. "space" or "a"
29         virtual void init(string const & symbolname) = 0;
30
31         /// Is this a valid key?
32         virtual bool isOK() const = 0;
33
34         /// Is this a modifier key only?
35         virtual bool isModifier() const = 0;
36
37         /// What is the symbolic name of this key? F.ex. "Return" or "c"
38         virtual string getSymbolName() const = 0;
39
40         /**
41          * Return the value of the keysym into the local ISO encoding.
42          * This converts the LyXKeySym to a 8-bit encoded character.
43          * This relies on user to use the right encoding.
44          */
45         virtual char getISOEncoded() const = 0;
46
47         /**
48          * We need to be able to equality compare these for the
49          * sake of the keymap business.
50          */
51         virtual bool operator==(LyXKeySym const & k) const = 0;
52 };
53
54 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
55
56 #endif