# WoopsiUI::WoopsiKeyboard Class Reference

`#include <woopsikeyboard.h>`

Inheritance diagram for WoopsiUI::WoopsiKeyboard:

List of all members.

## Public Member Functions
| WoopsiKeyboard (s16 x, s16 y, u32 flags, GadgetStyle *style=NULL)
virtual void | handleReleaseEvent (const GadgetEventArgs &e)
virtual void | handleReleaseOutsideEvent (const GadgetEventArgs &e)
virtual void | handleClickEvent (const GadgetEventArgs &e)
virtual void | handleActionEvent (const GadgetEventArgs &e)
virtual void | processKeyRelease (WoopsiKey *key)
const bool | isShiftDown () const
const bool | isControlDown () const
const bool | isCapsLockDown () const
void | addKeyboardEventHandler (KeyboardEventHandler *eventHandler)
void | removeKeyboardEventHandler (KeyboardEventHandler *eventHandler)
## Protected Member Functions
virtual void | drawBorder (GraphicsPort *port)
void | showCorrectKeys ()
void | showNormalKeys ()
void | showShiftKeys ()
void | showControlKeys ()
void | showShiftControlKeys ()
void | showCapsLockKeys ()
void | showControlCapsLockKeys ()
virtual | ~WoopsiKeyboard ()
| WoopsiKeyboard (const WoopsiKeyboard &keyboard)
void | raiseKeyboardPressEvent (WoopsiKey *key)
void | raiseKeyboardRepeatEvent (WoopsiKey *key)
void | raiseKeyboardReleaseEvent (WoopsiKey *key)
## Protected Attributes
WoopsiKey * | _shiftKey
WoopsiKey * | _controlKey
WoopsiKey * | _capsLockKey
bool | _isShiftDown
bool | _isControlDown
bool | _isCapsLockDown
WoopsiTimer * | _timer
u32 | _initialRepeatTime
u32 | _secondaryRepeatTime
WoopsiArray < KeyboardEventHandler * > | _keyboardEventHandlers

## Detailed Description

Class providing a window containing a multitude of buttons arranged like a keyboard. When any key is released the keyboard fires an EVENT_ACTION event.

## Constructor & Destructor Documentation

WoopsiUI::WoopsiKeyboard::WoopsiKeyboard | ( | s16 | x,
|  | s16 | y,
|  | u32 | flags,
|  | GadgetStyle * | style = `NULL` |
| ) |  |  |

Constructor.

Parameters:

  | x | The x co-ordinate of the window.
  | y | The y co-ordinate of the window.
  | flags | Standard flags. Setting GADGET_BORDERLESS hides the Amiga borders.
  | style | The style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object.

virtual WoopsiUI::WoopsiKeyboard::~WoopsiKeyboard | ( |  | ) | `[inline, protected, virtual]`

Destructor.

WoopsiUI::WoopsiKeyboard::WoopsiKeyboard | ( | const WoopsiKeyboard & | keyboard | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

void WoopsiUI::WoopsiKeyboard::addKeyboardEventHandler | ( | KeyboardEventHandler * | eventHandler | ) | `[inline]`

Adds a keyboard event handler. The event handler will receive all keyboard events raised by this gadget.

Parameters:

  | eventHandler | A pointer to the event handler.

virtual void WoopsiUI::WoopsiKeyboard::drawBorder | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters:

  | port | The GraphicsPort to draw to.

See also:
  redraw()

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::WoopsiKeyboard::handleActionEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event data to process.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::WoopsiKeyboard::handleClickEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event data to process.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::WoopsiKeyboard::handleReleaseEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event data to process.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::WoopsiKeyboard::handleReleaseOutsideEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event data to process.

Reimplemented from WoopsiUI::GadgetEventHandler.

const bool WoopsiUI::WoopsiKeyboard::isCapsLockDown | ( |  | ) | const`[inline]`

Check if the caps lock key is held down.

Returns:
  True if caps lock is down.

const bool WoopsiUI::WoopsiKeyboard::isControlDown | ( |  | ) | const`[inline]`

Check if the control key is held down.

Returns:
  True if control is down.

const bool WoopsiUI::WoopsiKeyboard::isShiftDown | ( |  | ) | const`[inline]`

Check if the shift key is held down.

Returns:
  True if shift is down.

virtual void WoopsiUI::WoopsiKeyboard::processKeyRelease | ( | WoopsiKey * | key | ) | `[virtual]`

Process key releases and tidy up the keyboard state.

Parameters:

  | key | Key that was released.

void WoopsiUI::WoopsiKeyboard::raiseKeyboardPressEvent | ( | WoopsiKey * | key | ) | `[protected]`

Raise a press event. Raised when a key is pressed.

Parameters:

  | key | The key that was pressed.

void WoopsiUI::WoopsiKeyboard::raiseKeyboardReleaseEvent | ( | WoopsiKey * | key | ) | `[protected]`

Raise a release event. Raised when a key is released.

Parameters:

  | key | The key that was released.

void WoopsiUI::WoopsiKeyboard::raiseKeyboardRepeatEvent | ( | WoopsiKey * | key | ) | `[protected]`

Raise a repeat event. Raised when a key is held and repeats.

Parameters:

  | key | The key that was pressed.

void WoopsiUI::WoopsiKeyboard::removeKeyboardEventHandler | ( | KeyboardEventHandler * | eventHandler | ) |

Remove a keyboard event handler.

Parameters:

  | eventHandler | A pointer to the event handler to remove.

void WoopsiUI::WoopsiKeyboard::showCapsLockKeys | ( |  | ) | `[protected]`

Swap the keyboard layout to the caps locked display.

void WoopsiUI::WoopsiKeyboard::showControlCapsLockKeys | ( |  | ) | `[protected]`

Swap the keyboard layout to the controlled and caps locked display.

void WoopsiUI::WoopsiKeyboard::showControlKeys | ( |  | ) | `[protected]`

Swap the keyboard layout to the controlled display.

void WoopsiUI::WoopsiKeyboard::showCorrectKeys | ( |  | ) | `[protected]`

Swap the keyboard layout to the correct display based on current modifier keys.

void WoopsiUI::WoopsiKeyboard::showNormalKeys | ( |  | ) | `[protected]`

Swap the keyboard layout to the standard display.

void WoopsiUI::WoopsiKeyboard::showShiftControlKeys | ( |  | ) | `[protected]`

Swap the keyboard layout to the shifted and controlled display.

void WoopsiUI::WoopsiKeyboard::showShiftKeys | ( |  | ) | `[protected]`

Swap the keyboard layout to the shifted display.

## Member Data Documentation

WoopsiKey* WoopsiUI::WoopsiKeyboard::_capsLockKey`[protected]`

Pointer to the caps lock key

WoopsiKey* WoopsiUI::WoopsiKeyboard::_controlKey`[protected]`

Pointer to the control key

u32 WoopsiUI::WoopsiKeyboard::_initialRepeatTime`[protected]`

Time until held key starts to repeat

bool WoopsiUI::WoopsiKeyboard::_isCapsLockDown`[protected]`

True if caps lock key is currently in down position

bool WoopsiUI::WoopsiKeyboard::_isControlDown`[protected]`

True if control key is currently in down position

bool WoopsiUI::WoopsiKeyboard::_isShiftDown`[protected]`

True if shift key is currently in down position

WoopsiArray<KeyboardEventHandler*> WoopsiUI::WoopsiKeyboard::_keyboardEventHandlers`[protected]`

List of keyboard event handlers

u32 WoopsiUI::WoopsiKeyboard::_secondaryRepeatTime`[protected]`

Time until a key already repeating repeats again

WoopsiKey* WoopsiUI::WoopsiKeyboard::_shiftKey`[protected]`

Pointer to the shift key

WoopsiTimer* WoopsiUI::WoopsiKeyboard::_timer`[protected]`

Timer for handling key repeats

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

- woopsikeyboard.h