lyx_mirror/src/frontends/qt4/QLyXKeySym.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

88 lines
1.7 KiB
C++

// -*- C++ -*-
/**
* \file QLyXKeySym.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Asger and Jürgen
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QLYXKEYSYM_H
#define QLYXKEYSYM_H
#include "frontends/LyXKeySym.h"
#include <QString>
#include <QKeyEvent>
class QKeyEvent;
namespace lyx {
/**
* Qt-specific key press.
*
* This is some really sick stuff.
*/
class QLyXKeySym : public LyXKeySym {
public:
QLyXKeySym();
virtual ~QLyXKeySym() {}
/// .
/// inlined out because of profiling results under linux when
/// opening a document.
inline bool operator==(LyXKeySym const& ks) const;
/// delayed constructor
void set(QKeyEvent * ev);
/// set from a LyX symbolic name
virtual void init(std::string const & symbolname);
/// Is this a valid key?
virtual bool isOK() const;
/// Is this a modifier key only?
virtual bool isModifier() const;
/// return the LyX symbolic name
virtual std::string getSymbolName() const;
/// Is this normal insertable text ? (last ditch attempt only)
virtual bool isText() const;
/**
* 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;
/**
* Return a human-readable version of a key+modifier pair.
* This will be the GUI version (translated and with special
* characters for Mac OS X) when \c forgui is true.
*/
virtual docstring const print(key_modifier::state mod, bool forgui) const;
///
int key() const {
return key_;
}
private:
/// the Qt sym value
int key_;
/// the event string value
QString text_;
};
} // namespace lyx
#endif // QLYXKEYSYM_H