kdecore Library: kkeyserver_x11.h Source File (kdecore Library)

| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kkeyserver_x11.h

    00001 /*
    00002     Copyright (C) 2001 Ellis Whitehead <ellis@kde.org>
    00003
    00004     Win32 port:
    00005     Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
    00006
    00007     This library is free software; you can redistribute it and/or
    00008     modify it under the terms of the GNU Library General Public
    00009     License as published by the Free Software Foundation; either
    00010     version 2 of the License, or (at your option) any later version.
    00011
    00012     This library is distributed in the hope that it will be useful,
    00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015     Library General Public License for more details.
    00016
    00017     You should have received a copy of the GNU Library General Public License
    00018     along with this library; see the file COPYING.LIB.  If not, write to
    00019     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020     Boston, MA 02111-1307, USA.
    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
    00333     KDECORE_EXPORT uint modXModeSwitch();
    00334
    00346     KDECORE_EXPORT uint accelModMaskX();
    00347
    00357     KDECORE_EXPORT bool keyQtToSym( int keyQt, uint& sym );
    00358
    00367     KDECORE_EXPORT bool keyQtToMod( int keyQt, uint& mod );
    00368
    00377     KDECORE_EXPORT bool symToKeyQt( uint sym, int& keyQt );
    00378
    00389     KDECORE_EXPORT bool modToModQt( uint mod, int& modQt );
    00390
    00400     KDECORE_EXPORT bool modToModX( uint mod, uint& modX );
    00401
    00411     //wrapped for win32
    00412     KDECORE_EXPORT bool modXToModQt( uint modX, int& modQt );
    00413
    00417     KDECORE_EXPORT int qtButtonStateToMod( Qt::ButtonState s );
    00418
    00428     KDECORE_EXPORT bool modXToMod( uint modX, uint& mod );
    00429
    00441     KDECORE_EXPORT bool codeXToSym( uchar codeX, uint modX, uint& symX );
    00442
    00446     KDECORE_EXPORT QString modToStringInternal( uint mod );
    00447
    00454     KDECORE_EXPORT QString modToStringUser( uint mod );
    00455
    00460     KDECORE_EXPORT bool stringToSymMod( const QString&, uint& sym, uint& mod );
    00461
    00466     KDECORE_EXPORT void keyQtToKeyX( uint keyCombQt, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
    00467 }
    00468
    00469 #endif // !_KKEYSERVER_X11_H

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:08 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003