4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger and Jürgen
9 * Full author contact details are available in file CREDITS.
17 #include "key_state.h"
19 #include "support/docstring.h"
21 #include <boost/shared_ptr.hpp>
27 * This is a base class for representing a keypress.
28 * Each frontend has to implement this to provide
29 * the functionality that LyX needs in regards to
36 virtual ~LyXKeySym() {}
38 /// Initialize with the name of a key. F. ex. "space" or "a"
39 virtual void init(std::string const & symbolname) = 0;
41 /// Is this a valid key?
42 virtual bool isOK() const = 0;
44 /// Is this a modifier key only?
45 virtual bool isModifier() const = 0;
47 /// Is this normal insertable text ? (last ditch attempt only)
48 virtual bool isText() const = 0;
50 /// What is the symbolic name of this key? F.ex. "Return" or "c"
51 virtual std::string getSymbolName() const = 0;
54 * Return the value of the keysym into the UCS-4 encoding.
55 * This converts the LyXKeySym to a 32-bit encoded character.
57 virtual size_t getUCSEncoded() const = 0;
60 * Return a string describing the KeySym with modifier mod.
61 * Use the native UI format when \c forgui is true.
63 virtual docstring const print(key_modifier::state mod, bool forgui) const = 0;
68 * We need to be able to equality compare these for the
69 * sake of the keymap business.
71 bool operator==(LyXKeySym const & k1, LyXKeySym const & k2);
73 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;