# WoopsiUI::WoopsiKey Class Reference

`#include <woopsikey.h>`

Inheritance diagram for WoopsiUI::WoopsiKey:

List of all members.

## Public Types
enum | KeyType { KEY_NONE = 0, KEY_ALPHA_NUMERIC_SYMBOL = 1, KEY_RETURN = 3, KEY_CONTROL = 4, KEY_SHIFT = 5, KEY_CAPS_LOCK = 6, KEY_BACKSPACE = 7, KEY_SPACE = 8 }
enum | KeyMode { KEY_MODE_NORMAL = 0, KEY_MODE_SHIFT = 1, KEY_MODE_CONTROL = 2, KEY_MODE_SHIFT_CONTROL = 3, KEY_MODE_CAPS_LOCK = 4, KEY_MODE_CONTROL_CAPS_LOCK = 5 }
## Public Member Functions
| WoopsiKey (s16 x, s16 y, u16 width, u16 height, const WoopsiString &text, const KeyType keyType=KEY_ALPHA_NUMERIC_SYMBOL, GadgetStyle *style=NULL)
| WoopsiKey (s16 x, s16 y, u16 width, u16 height, const WoopsiString &normalText, const WoopsiString &shiftText, const WoopsiString &controlText, const WoopsiString &shiftControlText, const WoopsiString &capsLockText, const WoopsiString &controlCapsLockText, const KeyType keyType=KEY_ALPHA_NUMERIC_SYMBOL, GadgetStyle *style=NULL)
const KeyType | getKeyType () const
void | setKeyType (KeyType keyType)
void | setKeyMode (KeyMode keyMode)
const char | getValue () const
## Protected Member Functions
virtual | ~WoopsiKey ()
| WoopsiKey (const WoopsiKey &key)
## Protected Attributes
KeyType | _keyType
WoopsiString | _normalText
WoopsiString | _shiftText
WoopsiString | _controlText
WoopsiString | _shiftControlText
WoopsiString | _capsLockText
WoopsiString | _controlCapsLockText
KeyMode | _keyMode

## Detailed Description

Class providing a key for the WoopsiKeyboard class.

## Member Enumeration Documentation

enum WoopsiUI::WoopsiKey::KeyMode

Enum listing all possible modes a key can be in. The modes reflect the keyboard state (ie. which modifiers are held down?), and each key has a separate string to display for each different mode. There is no mode for shift and caps lock nor for shift, caps lock and control, since in those situations the functionality of caps lock is already provided by the shift key.

Enumerator:

  KEY_MODE_NORMAL | No modifiers held
  KEY_MODE_SHIFT | Shift key held
  KEY_MODE_CONTROL | Control key held
  KEY_MODE_SHIFT_CONTROL | Shift and control held
  KEY_MODE_CAPS_LOCK | Caps lock held
  KEY_MODE_CONTROL_CAPS_LOCK | Control and caps lock held

enum WoopsiUI::WoopsiKey::KeyType

Enum listing all possible types of key

Enumerator:

  KEY_NONE | No key; for completeness only
  KEY_ALPHA_NUMERIC_SYMBOL | Character, number or symbol key
  KEY_RETURN | Return/enter key
  KEY_CONTROL | Control (Ctrl) key
  KEY_SHIFT | Shift key
  KEY_CAPS_LOCK | Caps lock key
  KEY_BACKSPACE | Backspace (ie delete) key
  KEY_SPACE | Space bar

## Constructor & Destructor Documentation

WoopsiUI::WoopsiKey::WoopsiKey | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | const WoopsiString & | text,
|  | const KeyType | keyType = `KEY_ALPHA_NUMERIC_SYMBOL`,
|  | GadgetStyle * | style = `NULL` |
| ) |  |  |

Constructor for keys for the keyboard that display a string. Same text is used regardless of which modifier keys are held down.

Parameters:

  | x | The x co-ordinate of the button, relative to its parent.
  | y | The y co-ordinate of the button, relative to its parent.
  | width | The width of the key.
  | height | The height of the key.
  | text | The text for the key to display.
  | keyType | The type of key.
  | 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.

WoopsiUI::WoopsiKey::WoopsiKey | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | const WoopsiString & | normalText,
|  | const WoopsiString & | shiftText,
|  | const WoopsiString & | controlText,
|  | const WoopsiString & | shiftControlText,
|  | const WoopsiString & | capsLockText,
|  | const WoopsiString & | controlCapsLockText,
|  | const KeyType | keyType = `KEY_ALPHA_NUMERIC_SYMBOL`,
|  | GadgetStyle * | style = `NULL` |
| ) |  |  |

Constructor for keys for the keyboard that display a string. Different string is supplied for each keyboard modifier situation.

Parameters:

  | x | The x co-ordinate of the button, relative to its parent.
  | y | The y co-ordinate of the button, relative to its parent.
  | width | The width of the key.
  | height | The height of the key.
  | normalText | The text for the key to display when no modifiers are held.
  | shiftText | The text for the key to display when shift is held.
  | controlText | The text for the key to display when control is held.
  | shiftControlText | The text for the key to display when shift and control are held.
  | capsLockText | The text for the key to display when caps lock is held.
  | controlCapsLockText | The text for the key to display when caps lock and control are held.
  | keyType | The type of key.
  | 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::WoopsiKey::~WoopsiKey | ( |  | ) | `[inline, protected, virtual]`

Destructor.

WoopsiUI::WoopsiKey::WoopsiKey | ( | const WoopsiKey & | key | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

const KeyType WoopsiUI::WoopsiKey::getKeyType | ( |  | ) | const`[inline]`

Return the type of key this object represents.

Returns:
  The key type.

const char WoopsiUI::WoopsiKey::getValue | ( |  | ) | const

Get the value represented by this key. This is the text that should (for example) be printed to the screen when the key is clicked. Modifier keys return the string terminator character.

Returns:
  The value of the key

void WoopsiUI::WoopsiKey::setKeyMode | ( | KeyMode | keyMode | ) |

Set the mode of the key. Should only be called by the keyboard itself.

Parameters:

  | keyMode | The new mode for this key.

void WoopsiUI::WoopsiKey::setKeyType | ( | KeyType | keyType | ) | `[inline]`

Set the type of this key.

Parameters:

  | keyType | The new keytype for this key.

## Member Data Documentation

WoopsiString WoopsiUI::WoopsiKey::_capsLockText`[protected]`

Text displayed when in caps lock mode

WoopsiString WoopsiUI::WoopsiKey::_controlCapsLockText`[protected]`

Text displayed when in control/caps lock mode

WoopsiString WoopsiUI::WoopsiKey::_controlText`[protected]`

Text displayed when in control mode

KeyMode WoopsiUI::WoopsiKey::_keyMode`[protected]`

Current mode

KeyType WoopsiUI::WoopsiKey::_keyType`[protected]`

Type of key represented by this object

WoopsiString WoopsiUI::WoopsiKey::_normalText`[protected]`

Text displayed when in normal mode

WoopsiString WoopsiUI::WoopsiKey::_shiftControlText`[protected]`

Text displayed when in shift/control mode

WoopsiString WoopsiUI::WoopsiKey::_shiftText`[protected]`

Text displayed when in shift mode

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

- woopsikey.h