# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KKeyNative Class Reference

Representation of a key in the format native of the windowing system (eg. More...

`#include <kkeynative.h>`

List of all members.

## Public Member Functions

| KKeyNative ()
| Creates a new null KKey.
| KKeyNative (const XEvent *xevent)
| Extracts a new native key from the given xevent.
| KKeyNative (const KKey &key)
| Creates a new native key for the given KKey code.
| KKeyNative (const KKeyNative &)
| Copy constructor.
| KKeyNative (uint code, uint mod, uint sym)
void | clear ()
| Clears the key.
bool | init (const XEvent *xevent)
| Initializes the native key by extracting the information from the given xevent.
bool | init (const KKey &key)
| Creates a new native key for the given KKey code.
bool | init (const KKeyNative &key)
| Copies the given key into this key.
KKeyNative & | operator= (const KKeyNative &key)
| Copies the given key into this key.
int | keyCodeQt () const
| Returns the qt key code.
KKey | key () const
| Returns the KKey representation of this key.
| operator KKey () const
| Converts this key to its KKey representation.
uint | code () const
| The native keycode of the key.
uint | mod () const
| The native modifier flags of the key.
uint | sym () const
| The native symbol (KeySym) of the key.
bool | isNull () const
| Returns true if the key is null (after clear() or empty constructor).
int | compare (const KKeyNative &key) const
| Compares this key with the given KKeyNative object.
bool | operator== (const KKeyNative &key) const
| Compares the symbol, modifiers and code of both keys.
bool | operator!= (const KKeyNative &key) const
| Compares the symbol, modifiers and code of both keys.
bool | operator< (const KKeyNative &key) const
| Compares the symbol, modifiers and code of both keys.

## Static Public Member Functions

KKeyNative & | null ()
| Returns a null key.
bool | keyboardHasWinKey ()
| Checks whether the keyboard has a Win key.
uint | modX (KKey::ModFlag modFlag)
| Returns the equivalent X modifier mask of the given modifier flag.
uint | accelModMaskX ()
| Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).
uint | modXNumLock ()
| Returns the X11 NumLock modifier mask/flag.
uint | modXLock ()
| Returns the X11 Lock modifier mask/flag.
uint | modXScrollLock ()
| Returns the X11 ScrollLock modifier mask/flag.

## Detailed Description

Representation of a key in the format native of the windowing system (eg.

X11).

See also:
  KKey

Definition at line 32 of file kkeynative.h.

## Constructor & Destructor Documentation

KKeyNative::KKeyNative | ( |  | ) |

Creates a new null KKey.

See also:
  clear()

  isNull()

  null()

KKeyNative::KKeyNative | ( | const XEvent * | xevent | ) |

Extracts a new native key from the given xevent.

Parameters:

  xevent | the XEvent that contains the key

KKeyNative::KKeyNative | ( | const KKey & | key | ) |

Creates a new native key for the given KKey code.

Parameters:

  key | the KKey that contains the generic key

KKeyNative::KKeyNative | ( | const KKeyNative & |  | ) |

| Copy constructor.

## Member Function Documentation

void KKeyNative::clear | ( |  | ) |

Clears the key.

The key is null after calling this function.

See also:
  isNull()

bool KKeyNative::init | ( | const XEvent * | xevent | ) |

Initializes the native key by extracting the information from the given xevent.

Parameters:

  xevent | the XEvent that contains the key

Returns:
  true if succesful, false otherwise

Referenced by operator=().

bool KKeyNative::init | ( | const KKey & | key | ) |

Creates a new native key for the given KKey code.

Parameters:

  key | the KKey that contains the generic key

Returns:
  true if succesful, false otherwise

bool KKeyNative::init | ( | const KKeyNative & | key | ) |

Copies the given key into this key.

Parameters:

  key | the key to copy

Returns:
  true if succesful, false otherwise

KKeyNative& KKeyNative::operator= | ( | const KKeyNative & | key | ) | `[inline]`

Copies the given key into this key.

Parameters:

  key | the key to copy

Returns:
  this key

Definition at line 99 of file kkeynative.h.

References init(), and KStdAccel::key().

int KKeyNative::keyCodeQt | ( |  | ) | const

Returns the qt key code.

Returns:
  the qt key code or 0 if there is no key set.

See also:
  Qt::Key

KKey KKeyNative::key | ( |  | ) | const

Returns the KKey representation of this key.

Returns:
  the KKey representation

Referenced by operator KKey().

KKeyNative::operator KKey | ( |  | ) | const`[inline]`

Converts this key to its KKey representation.

Returns:
  the KKey representation

See also:
  key()

Definition at line 121 of file kkeynative.h.

References key().

uint KKeyNative::code | ( |  | ) | const

The native keycode of the key.

Returns:
  the native keycode

uint KKeyNative::mod | ( |  | ) | const

The native modifier flags of the key.

Returns:
  the native modifier flags

uint KKeyNative::sym | ( |  | ) | const

The native symbol (KeySym) of the key.

Returns:
  the native symbol (KeySym)

bool KKeyNative::isNull | ( |  | ) | const

Returns true if the key is null (after clear() or empty constructor).

Returns:
  true if the key is null

See also:
  clear()

  null()

int KKeyNative::compare | ( | const KKeyNative & | key | ) | const

Compares this key with the given KKeyNative object.

Returns a negative number if the given KKeyNative is larger, 0 if they are equal and a positive number this KKeyNative is larger. The returned value is the difference between the symbol, modifier or code, whatever is non-zero first.

Parameters:

  key | the key to compare with this key

Returns:
  a negative number if the given KKeyNative is larger, 0 if they are equal and a positive number this KKeyNative is larger

Referenced by operator!=(), operator<(), and operator==().

bool KKeyNative::operator== | ( | const KKeyNative & | key | ) | const`[inline]`

Compares the symbol, modifiers and code of both keys.

See also:
  compare()

Definition at line 167 of file kkeynative.h.

References compare(), and KStdAccel::key().

bool KKeyNative::operator!= | ( | const KKeyNative & | key | ) | const`[inline]`

Compares the symbol, modifiers and code of both keys.

See also:
  compare()

Definition at line 174 of file kkeynative.h.

References compare(), and KStdAccel::key().

bool KKeyNative::operator< | ( | const KKeyNative & | key | ) | const`[inline]`

Compares the symbol, modifiers and code of both keys.

See also:
  compare()

Definition at line 181 of file kkeynative.h.

References compare(), and KStdAccel::key().

KKeyNative& KKeyNative::null | ( |  | ) | `[static]`

Returns a null key.

Returns:
  the null key

See also:
  isNull()

  clear()

bool KKeyNative::keyboardHasWinKey | ( |  | ) | `[static]`

Checks whether the keyboard has a Win key.

Returns:
  true if the keyboard has a Win key

uint KKeyNative::modX | ( | KKey::ModFlag | modFlag | ) | `[static]`

Returns the equivalent X modifier mask of the given modifier flag.

Parameters:

  modFlag | the mod flags to test

Returns:
  the equivalent native flags of the window system

uint KKeyNative::accelModMaskX | ( |  | ) | `[static]`

Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).

Returns:
  the mask of Shift, Ctrl, Alt and Win.

uint KKeyNative::modXNumLock | ( |  | ) | `[static]`

Returns the X11 NumLock modifier mask/flag.

Returns:
  the X11 NumLock modifier mask/flag.

See also:
  accelModMaskX()

uint KKeyNative::modXLock | ( |  | ) | `[static]`

Returns the X11 Lock modifier mask/flag.

Returns:
  the X11 Lock modifier mask/flag.

See also:
  accelModMaskX()

uint KKeyNative::modXScrollLock | ( |  | ) | `[static]`

Returns the X11 ScrollLock modifier mask/flag.

Returns:
  the X11 ScrollLock modifier mask/flag.

See also:
  accelModMaskX()

The documentation for this class was generated from the following file:

- kkeynative.h

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:49:33 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001