kkeynative.h
/* This file is part of the KDE libraries
Copyright (C) 2002 Ellis Whitehead <ellis@kde.org>
Win32 port:
Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __KKEYNATIVE_H
#define __KKEYNATIVE_H
#include <kshortcut.h>
#ifdef Q_WS_X11
typedef union _XEvent XEvent;
#endif
class KKeyNativePrivate;
class KDECORE_EXPORT KKeyNative
{
public:
KKeyNative();
#ifdef Q_WS_X11
KKeyNative( const XEvent* xevent );
#endif
KKeyNative( const KKey& key );
KKeyNative( const KKeyNative& );
KKeyNative( uint code, uint mod, uint sym );
~KKeyNative();
void clear();
#ifdef Q_WS_X11
bool init( const XEvent* xevent );
#endif
bool init( const KKey& key );
bool init( const KKeyNative& key );
KKeyNative& operator =( const KKeyNative& key )
{ init( key ); return *this; }
int keyCodeQt() const;
KKey key() const;
operator KKey() const { return key(); }
uint code() const;
uint mod() const;
uint sym() const;
bool isNull() const;
int compare( const KKeyNative& key ) const;
bool operator == ( const KKeyNative& key ) const
{ return compare( key ) == 0; }
bool operator != ( const KKeyNative& key ) const
{ return compare( key ) != 0; }
bool operator < ( const KKeyNative& key ) const
{ return compare( key ) < 0; }
static KKeyNative& null();
// General query functions. //
static bool keyboardHasWinKey();
#ifdef Q_WS_X11
static uint modX( KKey::ModFlag modFlag );
static uint accelModMaskX();
static uint modXNumLock();
static uint modXLock();
static uint modXScrollLock();
static uint modXModeSwitch();
#endif
private:
uint m_code, m_mod, m_sym;
KKeyNativePrivate* d;
};
#endif // !__KKEYNATIVE_H
KKey::ModFlag
ModFlag
Flags to represent the modifiers.
Definition: kshortcut.h:53
KKeyNative
Representation of a key in the format native of the windowing system (eg.
Definition: kkeynative.h:37
KKey
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
Definition: kshortcut.h:40

KDE Home | KDE Accessibility Home | Description of Access Keys