kdecore Library API Documentation

kkeynative.h

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2002 Ellis Whitehead <ellis@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017     Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef __KKEYNATIVE_H
00021 #define __KKEYNATIVE_H
00022 
00023 #include <kshortcut.h>
00024 
00025 #ifdef Q_WS_X11
00026 typedef union _XEvent XEvent;
00027 #endif
00028 
00029 class KKeyNativePrivate;
00034 class KKeyNative
00035 {
00036  public:
00043     KKeyNative();
00044 
00045 #ifdef Q_WS_X11
00046 
00050     KKeyNative( const XEvent* xevent );
00051 #endif
00052 
00057     KKeyNative( const KKey& key );
00058 
00062     KKeyNative( const KKeyNative& );
00063 
00067     KKeyNative( uint code, uint mod, uint sym );
00068     ~KKeyNative();
00069 
00074     void clear();
00075 
00082     bool init( const XEvent* xevent );
00083 
00089     bool init( const KKey& key );
00090 
00096     bool init( const KKeyNative& key );
00097 
00103     KKeyNative& operator =( const KKeyNative& key )
00104         { init( key ); return *this; }
00105 
00112     int keyCodeQt() const;
00113 
00118     KKey key() const;
00119 
00125     operator KKey() const     { return key(); }
00126 
00131     uint code() const;
00132 
00137     uint mod() const;
00138 
00143     uint sym() const;
00144 
00152     bool isNull() const;
00153 
00165     int compare( const KKeyNative& key ) const;
00166 
00171     bool operator == ( const KKeyNative& key ) const
00172         { return compare( key ) == 0; }
00173 
00178     bool operator != ( const KKeyNative& key ) const
00179         { return compare( key ) != 0; }
00180 
00185     bool operator < ( const KKeyNative& key ) const
00186         { return compare( key ) < 0; }
00187 
00194     static KKeyNative& null();
00195 
00196     // General query functions. //
00201     static bool keyboardHasWinKey();
00202 
00208     static uint modX( KKey::ModFlag modFlag );
00209 
00215     static uint accelModMaskX();
00216 
00222     static uint modXNumLock();
00223 
00229     static uint modXLock();
00230 
00236     static uint modXScrollLock();
00237 
00238  private:
00239     uint m_code, m_mod, m_sym;
00240     KKeyNativePrivate* d;
00241 };
00242 
00243 #endif // !__KKEYNATIVE_H
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jan 22 16:43:42 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003