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