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