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 )
76 bool initQt(
int keyQt );
84 bool init(
const TQString &s );
95 TQString toStringInternal()
const;
101 TQString toString()
const;
110 uint getModsRequired()
const;
115 uint getSymVariation()
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 };
159 bool init(
const KKey& key,
bool bQt );
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; }
218 int compare(
const Key& key )
const;
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]; }
357 TDECORE_EXPORT
bool keyQtToSym(
int keyQt, uint& sym );
367 TDECORE_EXPORT
bool keyQtToMod(
int keyQt, uint& mod );
377 TDECORE_EXPORT
bool symToKeyQt( uint sym,
int& keyQt );
389 TDECORE_EXPORT
bool modToModQt( uint mod,
int& modQt );
441 TDECORE_EXPORT
bool codeXToSym( uchar codeX, uint
modX, uint& symX );
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 );
477 #endif // !_KKEYSERVER_X11_H
ExtraModFlag
Supplement enum KKey::ModFlag.
bool isNative() const
Checks whether the key code is a native code.
uint modXModeSwitch()
Returns the X11 Mode_switch modifier mask/flag.
Sym()
Creates a null symbol.
Sym(uint sym)
Creates asymbol with the given value.
uint m_code
The code of the key.
Representation of a key in the format native of the windowing system (eg.
uint code() const
Returns the code of the key.
bool modToModQt(uint mod, int &modQt)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed Qt key code modifiers.
void setKeycodeQt(int keyQt)
Sets the qt key code.
bool modXToMod(uint modX, uint &mod)
Converts the mask of ORed X11 modifiers to a mask of ORed KKey::ModFlag modifiers.
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
bool initializeMods()
TODO: please document.
Sym(const TQString &s)
Creates a symbol from the given string description.
uint accelModMaskX()
Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).
bool modToModX(uint mod, uint &modX)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed X11 modifiers.
A collection of functions for the conversion of key presses and their modifiers from the window syste...
uint m_sym
the actual value of the symbol
bool modXToModQt(uint modX, int &modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
uint modXCtrl()
Returns the X11 Ctrl modifier mask/flag.
uint sym() const
Returns the symbol of the key.
TQString modToStringUser(uint mod)
Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.
uint modXNumLock()
Returns the X11 NumLock modifier mask/flag.
uint modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
uint mod() const
Returns the modifiers of the key.
int qtButtonStateToMod(TQt::ButtonState s)
Converts the Qt-compatible button state to x11 modifier.
bool symToKeyQt(uint sym, int &keyQt)
Converts the given symbol to a Qt key code.
uint m_sym
The symbol of the key.
uint modXAlt()
Returns the X11 Alt (Mod1) 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...
uint modXShift()
Returns the X11 Shift modifier mask/flag.
bool keyQtToSym(int keyQt, uint &sym)
Extracts the symbol from the given Qt key and converts it to a symbol.
bool keyboardHasWinKey()
Returns true if the current keyboard layout supports the Win key.
uint m_mod
The modifiers of the key.
bool codeXToSym(uchar codeX, uint modX, uint &symX)
Converts a X11 key code and a mask of ORed X11 modifiers into a X11 symbol.
ModFlag
Flags to represent the modifiers.
TODO: please document this class.
uint modXLock()
Returns the X11 Lock modifier mask/flag.
int keyCodeQt() const
Returns the qt key code.
uint modX(KKey::ModFlag modFlag)
Returns the equivalent X modifier mask of the given modifier flag.
uint modXWin()
Returns the X11 Win (Mod3) modifier mask/flag.
uint stringUserToMod(const TQString &mod)
Converts the modifier given as user-readable string to KKey::ModFlag modifier, or 0.