mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-28 14:58:36 +00:00
ab54158447
When the commit string from the inputMethodEvent can be interpreted as characters bound to some action, dispatch this action instead of inserting the string. This is useful on an international keyboard, when diaresis+space gives a plain double quote. It is better in this case to enter a smart quote. Adapted from a patch from Daniel Ramoeller <d.lyx@web.de>. Fixes bug #10377.
83 lines
1.7 KiB
C++
83 lines
1.7 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file KeySymbol.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 KEYSYMBOL_H
|
|
#define KEYSYMBOL_H
|
|
|
|
#include "KeyModifier.h"
|
|
|
|
#include "support/docstring.h"
|
|
|
|
|
|
namespace lyx {
|
|
|
|
/**
|
|
* This is a class representing a keypress.
|
|
*/
|
|
class KeySymbol
|
|
{
|
|
public:
|
|
KeySymbol() : key_(0) {}
|
|
|
|
///
|
|
bool operator==(KeySymbol const & ks) const;
|
|
|
|
/// Initialize with the name of a key. F. ex. "space" or "a"
|
|
void init(std::string const & symbolname);
|
|
|
|
/// Initialize with some platform specific sym value
|
|
void init(int key);
|
|
|
|
/// Is this a valid key?
|
|
bool isOK() const;
|
|
|
|
/// Is this a modifier key only?
|
|
bool isModifier() const;
|
|
|
|
/// Is this normal insertable text ? (last ditch attempt only)
|
|
bool isText() const;
|
|
|
|
/// What is the symbolic name of this key? F.ex. "Return" or "c"
|
|
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.
|
|
*/
|
|
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)
|
|
*/
|
|
docstring const print(KeyModifier mod, bool forgui, bool untranslated = false) const;
|
|
|
|
///
|
|
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
|
|
|
|
#endif
|