23#ifndef _KKEYSERVER_X11_H
24#define _KKEYSERVER_X11_H
26#include "tdeshortcut.h"
27#include "kkeynative.h"
47 struct TDECORE_EXPORT
Sym
67 Sym(
const TQString& s )
84 bool init(
const TQString &s );
95 TQString toStringInternal()
const;
120 operator uint()
const {
return m_sym; }
125 Sym& operator =( uint sym ) { m_sym = sym;
return *
this; }
128 TQString toString(
bool bUserSpace )
const;
130 static void capitalizeKeyname( TQString& );
140 enum { CODE_FOR_QT = 256 };
168 bool isNative()
const {
return m_code != CODE_FOR_QT; }
174 uint
code()
const {
return m_code; }
180 uint
mod()
const {
return m_mod; }
186 uint
sym()
const {
return m_sym; }
199 { m_code = CODE_FOR_QT; m_sym = keyQt; }
224 bool operator ==(
const Key& b )
const
225 {
return compare( b ) == 0; }
231 bool operator <(
const Key& b )
const
232 {
return compare( b ) < 0; }
246 enum { MAX_VARIATIONS = 4 };
248 Key m_rgkey[MAX_VARIATIONS];
253 void init(
const KKey&,
bool bQt );
255 uint count()
const {
return m_nVariations; }
256 const Key& key( uint i )
const {
return m_rgkey[i]; }
446 TDECORE_EXPORT TQString modToStringInternal( uint mod );
468 TDECORE_EXPORT
bool stringToSymMod(
const TQString&, uint& sym, uint& mod );
474 TDECORE_EXPORT
void keyQtToKeyX( uint keyCombQt,
unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
Representation of a key in the format native of the windowing system (eg.
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
ModFlag
Flags to represent the modifiers.
A collection of functions for the conversion of key presses and their modifiers from the window syste...
uint modXModeSwitch()
Returns the X11 Mode_switch modifier mask/flag.
uint modX(KKey::ModFlag modFlag)
Returns the equivalent X modifier mask of the given modifier flag.
ExtraModFlag
Supplement enum KKey::ModFlag.
int qtButtonStateToMod(TQt::ButtonState s)
Converts the Qt-compatible button state to x11 modifier.
uint modXShift()
Returns the X11 Shift modifier mask/flag.
uint modXNumLock()
Returns the X11 NumLock modifier mask/flag.
bool keyQtToSym(int keyQt, uint &sym)
Extracts the symbol from the given Qt key and converts it to a symbol.
bool modXToModQt(uint modX, int &modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
bool symToKeyQt(uint sym, int &keyQt)
Converts the given symbol to a Qt key code.
uint modXWin()
Returns the X11 Win (Mod3) modifier mask/flag.
uint modXLock()
Returns the X11 Lock modifier mask/flag.
uint stringUserToMod(const TQString &mod)
Converts the modifier given as user-readable string to KKey::ModFlag modifier, or 0.
bool keyboardHasWinKey()
Returns true if the current keyboard layout supports the Win key.
bool modToModX(uint mod, uint &modX)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed X11 modifiers.
bool codeXToSym(uchar codeX, uint modX, uint &symX)
Converts a X11 key code and a mask of ORed X11 modifiers into a X11 symbol.
bool modToModQt(uint mod, int &modQt)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed Qt key code modifiers.
TQString modToStringUser(uint mod)
Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.
bool modXToMod(uint modX, uint &mod)
Converts the mask of ORed X11 modifiers to a mask of ORed KKey::ModFlag modifiers.
uint accelModMaskX()
Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).
uint modXAlt()
Returns the X11 Alt (Mod1) modifier mask/flag.
uint modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
bool keyQtToMod(int keyQt, uint &mod)
Extracts the modifiers from the given Qt key and converts them in a mask of ORed KKey::ModFlag modifi...
bool initializeMods()
TODO: please document.
uint modXCtrl()
Returns the X11 Ctrl modifier mask/flag.
bool isNative() const
Checks whether the key code is a native code.
uint sym() const
Returns the symbol of the key.
KKey key() const
Converts this Key to a KKey.
void setKeycodeQt(int keyQt)
Sets the qt key code.
uint m_code
The code of the key.
uint m_sym
The symbol of the key.
uint code() const
Returns the code of the key.
int keyCodeQt() const
Returns the qt key code.
uint mod() const
Returns the modifiers of the key.
int compare(const Key &key) const
Compares this key with the given Key object.
uint m_mod
The modifiers of the key.
bool init(const KKey &key, bool bQt)
Initializes the key with a KKey.
uint getSymVariation() const
TODO: please find out what this method does and document it.
int qt() const
Returns the qt key code of the symbol.
Sym(uint sym)
Creates asymbol with the given value.
uint m_sym
the actual value of the symbol
bool initQt(int keyQt)
Initializes the symbol with the given Qt key code.
TQString toString() const
Returns the string representation of the symbol.
uint getModsRequired() const
Returns the mods that are required for this symbol as ORed KKey::ModFlag's.
bool init(const TQString &s)
Initializes the key with the given string description.
Sym()
Creates a null symbol.
Sym(const TQString &s)
Creates a symbol from the given string description.
TODO: please document this class.