CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csKeyboardDriver Class Reference

Generic Keyboard Driver. More...

#include <csinput.h>

Inheritance diagram for csKeyboardDriver:

csInputDriver iKeyboardDriver iBase List of all members.

Public Methods

 csKeyboardDriver (iObjectRegistry *)
 Initialize keyboard interface.

virtual ~csKeyboardDriver ()
 Destructor.

virtual void Reset ()
 Call to release all key down flags.

virtual void RestoreKeys ()
 Call to get the key down flags in sync with the actual pressed keys.

virtual void DoKey (utf32_char codeRaw, utf32_char codeCooked, bool iDown, bool autoRepeat=false, csKeyCharType charType=csKeyCharTypeNormal)
 Call this routine to add a key down/up event to queue.

virtual bool GetKeyState (utf32_char codeRaw)
 Query the state of a key.

virtual uint32 GetModifierState (utf32_char codeRaw)
 Query the state of a modifier key.

virtual csPtr< iKeyComposerCreateKeyComposer ()
 Return an instance of the keyboard composer.

virtual void LostFocus ()
 Application lost focus.


Public Attributes

csKeyboardDriver::eiEventHandler scfiEventHandler
 iEventHandler implementation


Protected Methods

virtual void SetKeyState (utf32_char codeRaw, bool iDown, bool autoRepeat)
 Set key state.

virtual void SynthesizeCooked (utf32_char codeRaw, const csKeyModifiers &modifiers, utf32_char &codeCooked)
 Generates a 'cooked' key code for a 'raw' key code from some simple rules.


Protected Attributes

csHash< bool, utf32_charkeyStates
 Key state array.


Detailed Description

Generic Keyboard Driver.

Keyboard driver should generate events and put them into an event queue. Also it tracks the current state of all keys.

Definition at line 84 of file csinput.h.


Constructor & Destructor Documentation

csKeyboardDriver::csKeyboardDriver iObjectRegistry  
 

Initialize keyboard interface.

virtual csKeyboardDriver::~csKeyboardDriver   [virtual]
 

Destructor.


Member Function Documentation

virtual csPtr<iKeyComposer> csKeyboardDriver::CreateKeyComposer   [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.

Implements iKeyboardDriver.

virtual void csKeyboardDriver::DoKey utf32_char    codeRaw,
utf32_char    codeCooked,
bool    iDown,
bool    autoRepeat = false,
csKeyCharType    charType = csKeyCharTypeNormal
[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, dead or composed character.

Implements iKeyboardDriver.

virtual bool csKeyboardDriver::GetKeyState utf32_char    codeRaw [virtual]
 

Query the state of a key.

All key codes in range 0..255, CSKEY_FIRST..CSKEY_LAST are supported. Returns true if the key is pressed, false if not.

Implements iKeyboardDriver.

virtual uint32 csKeyboardDriver::GetModifierState utf32_char    codeRaw [virtual]
 

Query the state of a modifier key.

Returns a bit field, where the nth bit is set if the nth modifier of a type is pressed. If a specific modifier is requested, e.g. CSKEY_SHIFT_LEFT, only the according bit is set. Otherwise, for a generic modifier (e.g. CSKEY_SHIFT), all distinct modifier keys of that type are represented.

Example: Test if any Alt key is pressed:

   bool pressed = (KeyboardDriver->GetModifierState (CSKEY_ALT) != 0);
Example: Test if the right Ctrl key is pressed:
   bool pressed = (KeyboardDriver->GetModifierState (CSKEY_CTRL_RIGHT) != 0);
Parameters:
codeRaw  Raw code of the modifier key.
Returns:
Bit mask with the pressed modifiers.

Implements iKeyboardDriver.

virtual void csKeyboardDriver::LostFocus   [inline, virtual]
 

Application lost focus.

Implements csInputDriver.

Definition at line 160 of file csinput.h.

References iKeyboardDriver::Reset().

virtual void csKeyboardDriver::Reset   [virtual]
 

Call to release all key down flags.

Implements iKeyboardDriver.

virtual void csKeyboardDriver::RestoreKeys   [virtual]
 

Call to get the key down flags in sync with the actual pressed keys.

virtual void csKeyboardDriver::SetKeyState utf32_char    codeRaw,
bool    iDown,
bool    autoRepeat
[protected, virtual]
 

Set key state.

For example SetKey (CSKEY_UP, true). Called automatically by do_press and do_release.

virtual void csKeyboardDriver::SynthesizeCooked utf32_char    codeRaw,
const csKeyModifiers   modifiers,
utf32_char   codeCooked
[protected, virtual]
 

Generates a 'cooked' key code for a 'raw' key code from some simple rules.


Member Data Documentation

csHash<bool, utf32_char> csKeyboardDriver::keyStates [protected]
 

Key state array.

Definition at line 89 of file csinput.h.

csKeyboardDriver::eiEventHandler csKeyboardDriver::scfiEventHandler
 

iEventHandler implementation


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18