Fcitx
Public Member Functions | Static Public Member Functions | List of all members
fcitx::Key Class Reference

Describe a Key in fcitx. More...

#include <fcitx-utils/key.h>

Public Member Functions

 Key (KeySym sym=FcitxKey_None, KeyStates states=KeyStates(), int code=0)
 
 Key (const char *keyString)
 Parse a key from string. More...
 
 Key (const std::string &keyString)
 Parse a key from std::string. More...
 
bool operator== (const Key &key) const
 Check if key is exactly same.
 
bool operator!= (const Key &key) const
 Check if key is not same;.
 
bool check (const Key &key) const
 Check if current key match the key.
 
bool check (KeySym sym=FcitxKey_None, KeyStates states=KeyStates()) const
 Check if current key match the sym and states. More...
 
bool isReleaseOfModifier (const Key &key) const
 Check if current key is a key release of given modifier only key. More...
 
bool isDigit () const
 Check if key is digit key or keypad digit key. More...
 
int digit () const
 Return the value of digit key. More...
 
int digitSelection (KeyStates states=KeyStates()) const
 Return index when using digit key for selection. More...
 
bool isUAZ () const
 Check if key is upper case.
 
bool isLAZ () const
 Check if key is lower case.
 
bool isSimple () const
 Check if key is in the range of ascii and has no states.
 
bool isModifier () const
 Check if the key is a modifier press.
 
bool isCursorMove () const
 Check if this key will cause cursor to move, e.g. More...
 
bool isKeyPad () const
 Check if this key is a key pad key.
 
bool hasModifier () const
 Check if states has modifier.
 
bool isVirtual () const
 Check if states has virtual bit.
 
Key normalize () const
 Normalize a key, usually used when key is from frontend. More...
 
std::string toString (KeyStringFormat format=KeyStringFormat::Portable) const
 Convert key to a string. More...
 
bool isValid () const
 Check if the sym is not FcitxKey_None or FcitxKey_VoidSymbol.
 
KeySym sym () const
 
KeyStates states () const
 
int code () const
 
template<typename Container >
bool checkKeyList (const Container &c) const
 Check the current key against a key list. More...
 
template<typename Container >
int keyListIndex (const Container &c) const
 Check the current key against a key list and get the matched key index. More...
 

Static Public Member Functions

static Key fromKeyCode (int code=0, KeyStates states=KeyStates())
 Create a key code based key with empty key symbol.
 
static KeyStates keySymToStates (KeySym sym)
 Convert the modifier symbol to its corresponding states.
 
static KeySym keySymFromString (const std::string &keyString)
 Convert a key symbol string to KeySym.
 
static std::string keySymToString (KeySym sym, KeyStringFormat format=KeyStringFormat::Portable)
 Convert keysym to a string. More...
 
static KeySym keySymFromUnicode (uint32_t unicode)
 Convert unicode to key symbol. More...
 
static uint32_t keySymToUnicode (KeySym sym)
 Convert keysym to a unicode. More...
 
static std::string keySymToUTF8 (KeySym sym)
 Convert keysym to a unicode string. More...
 
static KeyList keyListFromString (const std::string &str)
 Parse a list of key string into a KeyList.
 
template<typename Container >
static std::string keyListToString (const Container &container, KeyStringFormat format=KeyStringFormat::Portable)
 Convert a key list to string.
 

Detailed Description

Describe a Key in fcitx.

Definition at line 41 of file key.h.


The documentation for this class was generated from the following files: