kkeyserver_x11.h
00001 #ifndef _KKEYSERVER_X11_H
00002 #define _KKEYSERVER_X11_H
00003
00004 #include "kshortcut.h"
00005 #include "kkeynative.h"
00006
00012 namespace KKeyServer
00013 {
00018 enum ExtraModFlag { MODE_SWITCH = 0x2000 };
00019
00025 struct Sym
00026 {
00027 public:
00029 uint m_sym;
00030
00032 Sym()
00033 { m_sym = 0; }
00038 Sym( uint sym )
00039 { m_sym = sym; }
00045 Sym( const QString& s )
00046 { init( s ); }
00047
00054 bool initQt( int keyQt );
00055
00062 bool init( const QString &s );
00063
00068 int qt() const;
00069
00073 QString toStringInternal() const;
00074
00079 QString toString() const;
00080
00088 uint getModsRequired() const;
00089
00093 uint getSymVariation() const;
00094
00098 operator uint() const { return m_sym; }
00099
00103 Sym& operator =( uint sym ) { m_sym = sym; return *this; }
00104
00105 private:
00106 QString toString( bool bUserSpace ) const;
00107
00108 static void capitalizeKeyname( QString& );
00109 };
00110
00115 struct Key
00116 {
00118 enum { CODE_FOR_QT = 256 };
00119
00121 uint m_code;
00122
00124 uint m_mod;
00125
00127 uint m_sym;
00128
00137 bool init( const KKey& key, bool bQt );
00138
00146 bool isNative() const { return m_code != CODE_FOR_QT; }
00147
00152 uint code() const { return m_code; }
00153
00158 uint mod() const { return m_mod; }
00159
00164 uint sym() const { return m_sym; }
00165
00170 int keyCodeQt() const { return (int) m_sym; }
00171
00176 void setKeycodeQt( int keyQt )
00177 { m_code = CODE_FOR_QT; m_sym = keyQt; }
00178
00183 Key& operator =( const KKeyNative& key );
00184
00196 int compare( const Key& key ) const;
00197
00202 bool operator ==( const Key& b ) const
00203 { return compare( b ) == 0; }
00204
00209 bool operator <( const Key& b ) const
00210 { return compare( b ) < 0; }
00211
00216 KKey key() const;
00217 };
00218
00222 struct Variations
00223 {
00224 enum { MAX_VARIATIONS = 4 };
00225
00226 Key m_rgkey[MAX_VARIATIONS];
00227 uint m_nVariations;
00228
00229 Variations() { m_nVariations = 0; }
00230
00231 void init( const KKey&, bool bQt );
00232
00233 uint count() const { return m_nVariations; }
00234 const Key& key( uint i ) const { return m_rgkey[i]; }
00235 };
00236
00238 bool initializeMods();
00239
00245 uint modX( KKey::ModFlag modFlag );
00246
00253 bool keyboardHasWinKey();
00254
00260 uint modXShift();
00261
00267 uint modXLock();
00268
00274 uint modXCtrl();
00275
00281 uint modXAlt();
00282
00288 uint modXNumLock();
00289
00296 uint modXWin();
00297
00303 uint modXScrollLock();
00304
00316 uint accelModMaskX();
00317
00327 bool keyQtToSym( int keyQt, uint& sym );
00328
00337 bool keyQtToMod( int keyQt, uint& mod );
00338
00347 bool symToKeyQt( uint sym, int& keyQt );
00348
00359 bool modToModQt( uint mod, int& modQt );
00360
00370 bool modToModX( uint mod, uint& modX );
00371
00381 bool modXToModQt( uint modX, int& modQt );
00382
00392 bool modXToMod( uint modX, uint& mod );
00393
00405 bool codeXToSym( uchar codeX, uint modX, uint& symX );
00406
00410 QString modToStringInternal( uint mod );
00411
00418 QString modToStringUser( uint mod );
00419
00424 bool stringToSymMod( const QString&, uint& sym, uint& mod );
00425
00430 void keyQtToKeyX( uint keyCombQt, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
00431 }
00432
00433 #endif // !_KKEYSERVER_X11_H
This file is part of the documentation for kdecore Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 4 22:43:31 2004 by
doxygen 1.3.6-20040222 written by
Dimitri van Heesch, © 1997-2003