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 <boost/shared_ptr.hpp>
22 * This is a base class for representing a keypress.
23 * Each frontend has to implement this to provide
24 * the functionality that LyX needs in regards to
31 virtual ~LyXKeySym() {}
33 /// Initialize with the name of a key. F. ex. "space" or "a"
34 virtual void init(std::string const & symbolname) = 0;
36 /// Is this a valid key?
37 virtual bool isOK() const = 0;
39 /// Is this a modifier key only?
40 virtual bool isModifier() const = 0;
42 /// Is this normal insertable text ? (last ditch attempt only)
43 virtual bool isText() const { return false; }
45 /// What is the symbolic name of this key? F.ex. "Return" or "c"
46 virtual std::string getSymbolName() const = 0;
49 * Return the value of the keysym into the local ISO encoding.
50 * This converts the LyXKeySym to a 8-bit encoded character.
51 * This relies on user to use the right encoding.
53 virtual char getISOEncoded(std::string const & encoding) const = 0;
56 * Return a string describing the KeySym with modifier mod.
57 * This should use the native UI format when applicable
59 virtual std::string const print(key_modifier::state mod) const = 0;
64 * We need to be able to equality compare these for the
65 * sake of the keymap business.
67 bool operator==(LyXKeySym const & k1, LyXKeySym const & k2);
69 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;