X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2FKeySymbol.h;h=6f9b0645f1412f95d8ffd1e7030f2cd519c8a17b;hb=7b431ff0ba662738baa82af6fc43098140e28460;hp=359ef3da653f0c5054df0be2d51bb9446f31297a;hpb=50016ccf3a1c010756427be49d376099e085d71c;p=lyx.git diff --git a/src/frontends/KeySymbol.h b/src/frontends/KeySymbol.h index 359ef3da65..6f9b0645f1 100644 --- a/src/frontends/KeySymbol.h +++ b/src/frontends/KeySymbol.h @@ -4,7 +4,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Asger and Jürgen + * \author Asger and Jürgen * * Full author contact details are available in file CREDITS. */ @@ -12,69 +12,66 @@ #ifndef KEYSYMBOL_H #define KEYSYMBOL_H -#include - -#include "key_state.h" +#include "KeyModifier.h" #include "support/docstring.h" -#include - namespace lyx { /** - * This is a base class for representing a keypress. - * Each frontend has to implement this to provide - * the functionality that LyX needs in regards to - * key presses. + * This is a class representing a keypress. */ -class KeySymbol { +class KeySymbol +{ public: - KeySymbol() {} - - virtual ~KeySymbol() {} + KeySymbol() : key_(0) {} /// - virtual bool operator==(KeySymbol const& ks) const = 0; + bool operator==(KeySymbol const & ks) const; /// Initialize with the name of a key. F. ex. "space" or "a" - virtual void init(std::string const & symbolname) = 0; + void init(std::string const & symbolname); /// Is this a valid key? - virtual bool isOK() const = 0; + bool isOK() const; /// Is this a modifier key only? - virtual bool isModifier() const = 0; + bool isModifier() const; /// Is this normal insertable text ? (last ditch attempt only) - virtual bool isText() const = 0; + bool isText() const; /// What is the symbolic name of this key? F.ex. "Return" or "c" - virtual std::string getSymbolName() const = 0; + std::string getSymbolName() const; /** * Return the value of the keysym into the UCS-4 encoding. * This converts the KeySymbol to a 32-bit encoded character. */ - virtual char_type getUCSEncoded() const = 0; + char_type getUCSEncoded() const; /** * Return a string describing the KeySym with modifier mod. * Use the native UI format when \c forgui is true. + * i.e. (translated and with special characters for Mac OS X) */ - virtual docstring const print(key_modifier::state mod, bool forgui) const = 0; -}; - - -typedef boost::shared_ptr KeySymbolPtr; - + docstring const print(KeyModifier mod, bool forgui) const; -/** - * Make a KeySymbol. Used because we want to - * generate a toolkit-specific instance. - */ -KeySymbol * createKeySymbol(); + /// + int key() const { return key_; } + /// + void setKey(int key) { key_ = key; } + /// + docstring text() const { return text_; } + /// + void setText(docstring const & text) { text_ = text; } +private: + /// some platform specific sym value + int key_; + /// the event string value + docstring text_; +}; } // namespace lyx