Woopsi 1.3
Nintendo DS Gui Framework
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
WoopsiUI::WoopsiKey Class Reference

#include <libwoopsi/include/woopsikey.h>

Inheritance diagram for WoopsiUI::WoopsiKey:
WoopsiUI::StickyButton WoopsiUI::Button WoopsiUI::Label WoopsiUI::Gadget

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 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 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. The same text is used regardless of which modifier keys are held down.

Parameters:
xThe x co-ordinate of the button, relative to its parent.
yThe y co-ordinate of the button, relative to its parent.
widthThe width of the key.
heightThe height of the key.
textThe text for the key to display.
keyTypeThe type of key.
styleThe 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. A different string is supplied for each keyboard modifier situation.

Parameters:
xThe x co-ordinate of the button, relative to its parent.
yThe y co-ordinate of the button, relative to its parent.
widthThe width of the key.
heightThe height of the key.
normalTextThe text for the key to display when no modifiers are held.
shiftTextThe text for the key to display when shift is held.
controlTextThe text for the key to display when control is held.
shiftControlTextThe text for the key to display when shift and control are held.
capsLockTextThe text for the key to display when caps lock is held.
controlCapsLockTextThe text for the key to display when caps lock and control are held.
keyTypeThe type of key.
styleThe 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:
keyModeThe new mode for this key.
void WoopsiUI::WoopsiKey::setKeyType ( KeyType  keyType) [inline]

Set the type of this key.

Parameters:
keyTypeThe new keytype for this key.

Member Data Documentation

Text displayed when in caps lock mode

Text displayed when in control/caps lock mode

Text displayed when in control mode

Current mode

Type of key represented by this object

Text displayed when in normal mode

Text displayed when in shift/control mode

Text displayed when in shift mode


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator