## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iKeyboardDriver Struct Reference
[Event handling]

Generic Keyboard Driver. More...

`#include <iutil/csinput.h>`

Inheritance diagram for iKeyboardDriver:

[legend]
List of all members.

## Public Member Functions

virtual csPtr< iKeyComposer > | CreateKeyComposer ()=0
| Return an instance of the keyboard composer.
virtual void | DoKey (utf32_char codeRaw, utf32_char codeCooked, bool iDown, bool autoRepeat=false, csKeyCharType charType=csKeyCharTypeNormal)=0
| Call this routine to add a key down/up event to queue.
virtual bool | GetKeyState (utf32_char codeRaw) const =0
| Query the state of a key.
virtual uint32 | GetModifierState (utf32_char codeRaw) const =0
| Get the current state of the modifiers.
virtual void | Reset ()=0
| Call to release all key down flags (when focus switches from application window, for example).
virtual csEventError | SynthesizeCooked (iEvent *)=0
| For an event that contains only a raw code, this adds cooked code and modifiers.

## Detailed Description

Generic Keyboard Driver.

Keyboard driver listens for keyboard-related events from the event queue, stores state about the keyboard, and possibly synthesizes additional events, such as when a character is "composed". Typically, one instance of this object is available from the shared-object registry (iObjectRegistry) under the name "crystalspace.driver.input.generic.keyboard".

Main creators of instances implementing this interface:

- csInitializer::CreateEnvironment()
- csInitializer::CreateInputDrivers()

Main ways to get pointers to this interface:

- CS_QUERY_REGISTRY()

Todo:
  Need a simple way to query all currently-set modifiers for event construction.

See also:
  csMouseDriver::DoButton()

  csMouseDriver::DoMotion()

  csJoystickDriver::DoButton()

  csJoystickDriver::DoMotion()

Definition at line 112 of file csinput.h.

## Member Function Documentation

virtual csPtr<iKeyComposer> iKeyboardDriver::CreateKeyComposer | ( |  | ) | `[pure virtual]`

Return an instance of the keyboard composer.

Remarks:
  All composers are independent. Specifically, passing a dead key to one composer won't affect the result after the next keyboard event of any other composer.

Implemented in csKeyboardDriver.

virtual void iKeyboardDriver::DoKey | ( | utf32_char | codeRaw,
|  | utf32_char | codeCooked,
|  | bool | iDown,
|  | bool | autoRepeat = `false`,
|  | csKeyCharType | charType = `csKeyCharTypeNormal`
| ) | `[pure virtual]`

Call this routine to add a key down/up event to queue.

Parameters:

  | codeRaw | 'Raw' code of the pressed key.
  | codeCooked | 'Cooked' code of the pressed key.
  | iDown | Whether the key is up or down.
  | autoRepeat | Auto-repeat flag for the key event. Typically only used by the platform-specific keyboard agents.
  | charType | When the cooked code is a character, it determines whether it is a normal, or dead character.

Implemented in csKeyboardDriver.

virtual bool iKeyboardDriver::GetKeyState | ( | utf32_char | codeRaw | ) | const`[pure virtual]`

| Query the state of a key. All key codes are supported. Returns true if the key is pressed, false if not. Implemented in csKeyboardDriver.

virtual uint32 iKeyboardDriver::GetModifierState | ( | utf32_char | codeRaw | ) | const`[pure virtual]`

| Get the current state of the modifiers. Implemented in csKeyboardDriver.

virtual void iKeyboardDriver::Reset | ( |  | ) | `[pure virtual]`

| Call to release all key down flags (when focus switches from application window, for example). Implemented in csKeyboardDriver.

virtual csEventError iKeyboardDriver::SynthesizeCooked | ( | iEvent * |  | ) | `[pure virtual]`

| For an event that contains only a raw code, this adds cooked code and modifiers. Implemented in csKeyboardDriver.

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

- iutil/csinput.h