kdecore Library API Documentation

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         
00020         struct CodeMod  { int code, mod; };
00021 
00027         struct Sym
00028         {
00029          public:
00031                 uint m_sym;
00032 
00034                 Sym()
00035                         { m_sym = 0; }
00040                 Sym( uint sym )
00041                         { m_sym = sym; }
00047                 Sym( const QString& s )
00048                         { init( s ); }
00049 
00056                 bool initQt( int keyQt );
00057           
00064                 bool init( const QString &s );
00065 
00070                 int qt() const;
00071 
00075                 QString toStringInternal() const;
00076 
00081                 QString toString() const;
00082 
00090                 uint getModsRequired() const;
00091 
00095                 uint getSymVariation() const;
00096 
00100                 operator uint() const { return m_sym; }
00101           
00105                 Sym& operator =( uint sym ) { m_sym = sym; return *this; }
00106 
00107          private:
00108                 QString toString( bool bUserSpace ) const;
00109 
00110                 static void capitalizeKeyname( QString& );
00111         };
00112 
00117         struct Key
00118         {
00120                 enum { CODE_FOR_QT = 256 };
00121 
00123                 uint m_code;
00124 
00126                 uint m_mod;
00127 
00129                 uint m_sym;
00130 
00139                 bool init( const KKey& key, bool bQt );
00140 
00148                 bool isNative() const { return m_code != CODE_FOR_QT; }
00149 
00154                 uint code() const { return m_code; }
00155 
00160                 uint mod() const { return m_mod; }
00161 
00166                 uint sym() const { return m_sym; }
00167 
00172                 int keyCodeQt() const { return (int) m_sym; }
00173 
00178                 void setKeycodeQt( int keyQt )
00179                         { m_code = CODE_FOR_QT; m_sym = keyQt; }
00180 
00185                 Key& operator =( const KKeyNative& key );
00186 
00198                 int compare( const Key& key ) const;
00199 
00204                 bool operator ==( const Key& b ) const
00205                         { return compare( b ) == 0; }
00206 
00211                 bool operator <( const Key& b ) const
00212                         { return compare( b ) < 0; }
00213 
00218                 KKey key() const;
00219         };
00220 
00224         struct Variations
00225         {
00226                 enum { MAX_VARIATIONS = 4 };
00227 
00228                 Key m_rgkey[MAX_VARIATIONS];
00229                 uint m_nVariations;
00230 
00231                 Variations() { m_nVariations = 0; }
00232 
00233                 void init( const KKey&, bool bQt );
00234                 
00235                 uint count() const { return m_nVariations; }
00236                 const Key& key( uint i ) const { return m_rgkey[i]; }
00237         };
00238 
00240         bool initializeMods();
00241 
00247         uint modX( KKey::ModFlag modFlag );
00248 
00255         bool keyboardHasWinKey();
00256 
00262         uint modXShift();
00263 
00269         uint modXLock();
00270 
00276         uint modXCtrl();
00277 
00283         uint modXAlt();
00284 
00290         uint modXNumLock();
00291 
00298         uint modXWin();
00299 
00305         uint modXScrollLock();
00306 
00318         uint accelModMaskX();
00319 
00329         bool keyQtToSym( int keyQt, uint& sym );
00330         
00339         bool keyQtToMod( int keyQt, uint& mod );
00340 
00349         bool symToKeyQt( uint sym, int& keyQt );
00350 
00361         bool modToModQt( uint mod, int& modQt );
00362 
00372         bool modToModX( uint mod, uint& modX );
00373 
00383         bool modXToModQt( uint modX, int& modQt );
00384 
00394         bool modXToMod( uint modX, uint& mod );
00395 
00407         bool codeXToSym( uchar codeX, uint modX, uint& symX );
00408 
00412         QString modToStringInternal( uint mod );
00413 
00420         QString modToStringUser( uint mod );
00421 
00426         bool stringToSymMod( const QString&, uint& sym, uint& mod );
00427 
00432         void keyQtToKeyX( uint keyCombQt, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
00433 }
00434 
00435 #endif // !_KKEYSERVER_X11_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:35 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001