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 "kshortcut.h"
00027 #include "kkeynative.h"
00028
00034 namespace KKeyServer
00035 {
00040 enum ExtraModFlag { MODE_SWITCH = 0x2000 };
00041
00047 struct KDECORE_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 QString& s )
00068 { init( s ); }
00069
00076 bool initQt( int keyQt );
00077
00084 bool init( const QString &s );
00085
00090 int qt() const;
00091
00095 QString toStringInternal() const;
00096
00101 QString 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 QString toString( bool bUserSpace ) const;
00129
00130 static void capitalizeKeyname( QString& );
00131 };
00132
00137 struct KDECORE_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 KDECORE_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 KDECORE_EXPORT bool initializeMods();
00261
00267 KDECORE_EXPORT uint modX( KKey::ModFlag modFlag );
00268
00275 KDECORE_EXPORT bool keyboardHasWinKey();
00276
00282 KDECORE_EXPORT uint modXShift();
00283
00289 KDECORE_EXPORT uint modXLock();
00290
00296 KDECORE_EXPORT uint modXCtrl();
00297
00303 KDECORE_EXPORT uint modXAlt();
00304
00310 KDECORE_EXPORT uint modXNumLock();
00311
00318 KDECORE_EXPORT uint modXWin();
00319
00325 KDECORE_EXPORT uint modXScrollLock();
00326
00338 KDECORE_EXPORT uint accelModMaskX();
00339
00349 KDECORE_EXPORT bool keyQtToSym( int keyQt, uint& sym );
00350
00359 KDECORE_EXPORT bool keyQtToMod( int keyQt, uint& mod );
00360
00369 KDECORE_EXPORT bool symToKeyQt( uint sym, int& keyQt );
00370
00381 KDECORE_EXPORT bool modToModQt( uint mod, int& modQt );
00382
00392 KDECORE_EXPORT bool modToModX( uint mod, uint& modX );
00393
00403
00404 KDECORE_EXPORT bool modXToModQt( uint modX, int& modQt );
00405
00409 KDECORE_EXPORT int qtButtonStateToMod( Qt::ButtonState s );
00410
00420 KDECORE_EXPORT bool modXToMod( uint modX, uint& mod );
00421
00433 KDECORE_EXPORT bool codeXToSym( uchar codeX, uint modX, uint& symX );
00434
00438 KDECORE_EXPORT QString modToStringInternal( uint mod );
00439
00446 KDECORE_EXPORT QString modToStringUser( uint mod );
00447
00452 KDECORE_EXPORT bool stringToSymMod( const QString&, uint& sym, uint& mod );
00453
00458 KDECORE_EXPORT void keyQtToKeyX( uint keyCombQt, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
00459 }
00460
00461 #endif // !_KKEYSERVER_X11_H
This file is part of the documentation for kdecore Library Version 3.4.0.