2002-06-18 15:44:30 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file LyXKeySym.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-18 15:44:30 +00:00
|
|
|
*
|
|
|
|
* \author Asger and Juergen
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-18 15:44:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LYXKEYSYM_H
|
|
|
|
#define LYXKEYSYM_H
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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() {}
|
|
|
|
|
|
|
|
/// Initialize with the name of a key. F. ex. "space" or "a"
|
|
|
|
virtual void init(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;
|
|
|
|
|
2002-12-12 13:46:06 +00:00
|
|
|
/// Is this normal insertable text ? (last ditch attempt only)
|
|
|
|
virtual bool isText() const { return false; }
|
2003-02-25 13:17:01 +00:00
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
/// What is the symbolic name of this key? F.ex. "Return" or "c"
|
|
|
|
virtual string getSymbolName() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the value of the keysym into the local ISO encoding.
|
|
|
|
* This converts the LyXKeySym to a 8-bit encoded character.
|
|
|
|
* This relies on user to use the right encoding.
|
|
|
|
*/
|
2003-01-05 22:38:42 +00:00
|
|
|
virtual char getISOEncoded(string const & encoding) const = 0;
|
2002-06-18 15:44:30 +00:00
|
|
|
};
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* We need to be able to equality compare these for the
|
|
|
|
* sake of the keymap business.
|
|
|
|
*/
|
2002-10-21 14:58:58 +00:00
|
|
|
bool operator==(LyXKeySym const & k1, LyXKeySym const & k2);
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
|
|
|
|
|
|
|
|
#endif
|