lyx_mirror/src/frontends/LyXKeySym.h
Georg Baum 9281cd4675 We use char_type, not size_t for storing UCS4 characters.
This may make a difference when char_type is signed.

	* src/frontends/LyXKeySym.h
	(getUCSEncoded): change return type from size_t to char_type

	* src/frontends/qt4/QLyXKeySym.[Ch]
	(getUCSEncoded): ditto

	* src/lyxfunc.C
	(LyXFunc::processKeySym): adjust to the above and add a FIXME since
	this is strange code that looks like it was not intended to do what
	it does.

	* src/lyxfunc.h
	(encoded_last_key): Correct documentation


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16833 a592a061-630c-0410-9148-cb99ea01b6c8
2007-01-24 14:01:34 +00:00

76 lines
1.6 KiB
C++

// -*- C++ -*-
/**
* \file LyXKeySym.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Asger and Jürgen
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYXKEYSYM_H
#define LYXKEYSYM_H
#include <string>
#include "key_state.h"
#include "support/docstring.h"
#include <boost/shared_ptr.hpp>
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.
*/
class LyXKeySym {
public:
LyXKeySym() {}
virtual ~LyXKeySym() {}
///
virtual bool operator==(LyXKeySym const& ks) const = 0;
/// Initialize with the name of a key. F. ex. "space" or "a"
virtual void init(std::string const & symbolname) = 0;
/// Is this a valid key?
virtual bool isOK() const = 0;
/// Is this a modifier key only?
virtual bool isModifier() const = 0;
/// Is this normal insertable text ? (last ditch attempt only)
virtual bool isText() const = 0;
/// What is the symbolic name of this key? F.ex. "Return" or "c"
virtual std::string getSymbolName() const = 0;
/**
* Return the value of the keysym into the UCS-4 encoding.
* This converts the LyXKeySym to a 32-bit encoded character.
*/
virtual char_type getUCSEncoded() const = 0;
/**
* Return a string describing the KeySym with modifier mod.
* Use the native UI format when \c forgui is true.
*/
virtual docstring const print(key_modifier::state mod, bool forgui) const = 0;
};
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
} // namespace lyx
#endif