tdecore
kkeyserver_x11.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _KKEYSERVER_X11_H
00024 #define _KKEYSERVER_X11_H
00025
00026 #include "tdeshortcut.h"
00027 #include "kkeynative.h"
00028
00034 namespace KKeyServer
00035 {
00040 enum ExtraModFlag { MODE_SWITCH = 0x2000 };
00041
00047 struct TDECORE_EXPORT Sym
00048 {
00049 public:
00051 uint m_sym;
00052
00054 Sym()
00055 { m_sym = 0; }
00060 Sym( uint sym )
00061 { m_sym = sym; }
00067 Sym( const TQString& s )
00068 { init( s ); }
00069
00076 bool initQt( int keyQt );
00077
00084 bool init( const TQString &s );
00085
00090 int qt() const;
00091
00095 TQString toStringInternal() const;
00096
00101 TQString toString() const;
00102
00110 uint getModsRequired() const;
00111
00115 uint getSymVariation() const;
00116
00120 operator uint() const { return m_sym; }
00121
00125 Sym& operator =( uint sym ) { m_sym = sym; return *this; }
00126
00127 private:
00128 TQString toString( bool bUserSpace ) const;
00129
00130 static void capitalizeKeyname( TQString& );
00131 };
00132
00137 struct TDECORE_EXPORT Key
00138 {
00140 enum { CODE_FOR_QT = 256 };
00141
00143 uint m_code;
00144
00146 uint m_mod;
00147
00149 uint m_sym;
00150
00159 bool init( const KKey& key, bool bQt );
00160
00168 bool isNative() const { return m_code != CODE_FOR_QT; }
00169
00174 uint code() const { return m_code; }
00175
00180 uint mod() const { return m_mod; }
00181
00186 uint sym() const { return m_sym; }
00187
00192 int keyCodeQt() const { return (int) m_sym; }
00193
00198 void setKeycodeQt( int keyQt )
00199 { m_code = CODE_FOR_QT; m_sym = keyQt; }
00200
00205 Key& operator =( const KKeyNative& key );
00206
00218 int compare( const Key& key ) const;
00219
00224 bool operator ==( const Key& b ) const
00225 { return compare( b ) == 0; }
00226
00231 bool operator <( const Key& b ) const
00232 { return compare( b ) < 0; }
00233
00238 KKey key() const;
00239 };
00240
00244 struct TDECORE_EXPORT Variations
00245 {
00246 enum { MAX_VARIATIONS = 4 };
00247
00248 Key m_rgkey[MAX_VARIATIONS];
00249 uint m_nVariations;
00250
00251 Variations() { m_nVariations = 0; }
00252
00253 void init( const KKey&, bool bQt );
00254
00255 uint count() const { return m_nVariations; }
00256 const Key& key( uint i ) const { return m_rgkey[i]; }
00257 };
00258
00260 TDECORE_EXPORT bool initializeMods();
00261
00267 TDECORE_EXPORT uint modX( KKey::ModFlag modFlag );
00268
00275 TDECORE_EXPORT bool keyboardHasWinKey();
00276
00282 TDECORE_EXPORT uint modXShift();
00283
00289 TDECORE_EXPORT uint modXLock();
00290
00296 TDECORE_EXPORT uint modXCtrl();
00297
00303 TDECORE_EXPORT uint modXAlt();
00304
00310 TDECORE_EXPORT uint modXNumLock();
00311
00318 TDECORE_EXPORT uint modXWin();
00319
00325 TDECORE_EXPORT uint modXScrollLock();
00326
00333 TDECORE_EXPORT uint modXModeSwitch();
00334
00346 TDECORE_EXPORT uint accelModMaskX();
00347
00357 TDECORE_EXPORT bool keyQtToSym( int keyQt, uint& sym );
00358
00367 TDECORE_EXPORT bool keyQtToMod( int keyQt, uint& mod );
00368
00377 TDECORE_EXPORT bool symToKeyQt( uint sym, int& keyQt );
00378
00389 TDECORE_EXPORT bool modToModQt( uint mod, int& modQt );
00390
00400 TDECORE_EXPORT bool modToModX( uint mod, uint& modX );
00401
00411
00412 TDECORE_EXPORT bool modXToModQt( uint modX, int& modQt );
00413
00417 TDECORE_EXPORT int qtButtonStateToMod( TQ_ButtonState s );
00418
00428 TDECORE_EXPORT bool modXToMod( uint modX, uint& mod );
00429
00441 TDECORE_EXPORT bool codeXToSym( uchar codeX, uint modX, uint& symX );
00442
00446 TDECORE_EXPORT TQString modToStringInternal( uint mod );
00447
00454 TDECORE_EXPORT TQString modToStringUser( uint mod );
00455
00462 TDECORE_EXPORT uint stringUserToMod( const TQString& mod );
00463
00468 TDECORE_EXPORT bool stringToSymMod( const TQString&, uint& sym, uint& mod );
00469
00474 TDECORE_EXPORT void keyQtToKeyX( uint keyCombQt, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
00475 }
00476
00477 #endif // !_KKEYSERVER_X11_H