mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
3b44c08e43
* BufferView_pimpl.h: delete LyXKeySymPtr typedef * kbmap.h: include LyXKeysym.h and remove forward declaration of LyXKeySym, and delete LyXKeySymPtr typedef * kbsequence.h: * frontends/WorkArea.h: delete LyXKeySymPtr typedef, include LyXKeySym.h and don't include boost/shared_ptr.hpp, remove forward declaration of LyXKeySym. * frontends/LyXKeySym.h: include boost/shared_ptr.hpp, and add typedef for LyXKeySymPtr git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13663 a592a061-630c-0410-9148-cb99ea01b6c8
72 lines
1.7 KiB
C++
72 lines
1.7 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 <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(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 { return false; }
|
|
|
|
/// 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 local ISO encoding.
|
|
* This converts the LyXKeySym to a 8-bit encoded character.
|
|
* This relies on user to use the right encoding.
|
|
*/
|
|
virtual char getISOEncoded(std::string const & encoding) const = 0;
|
|
|
|
/**
|
|
* Return a string describing the KeySym with modifier mod.
|
|
* This should use the native UI format when applicable
|
|
*/
|
|
virtual std::string const print(key_modifier::state mod) const = 0;
|
|
};
|
|
|
|
|
|
/**
|
|
* We need to be able to equality compare these for the
|
|
* sake of the keymap business.
|
|
*/
|
|
bool operator==(LyXKeySym const & k1, LyXKeySym const & k2);
|
|
|
|
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
|
|
|
|
#endif
|