Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

ptc::Key Class Reference

Describes a key press. More...

List of all members.

Public Members


Detailed Description

Describes a key press.

The key object represents a single key press.

Each key press consists of a key code that identifies the key pressed, and three modifier flags: alt, shift and control that indicate whether or not the alt, shift or control keys were held while the key was pressed.

Key objects are stored in a fifo queue internally inside the console class when a key is pressed and can be read using the Console::key() and Console::read() functions.


Member Enumeration Documentation

enum ptc::Key::Code

Key code values.

The integer value of each key code is guaranteed to be identical on all platforms.

Warning:
Not all platforms are capable of generating all key codes.

Enumeration values:


Member Function Documentation

ptc::Key::Key ()

Default constructor.

code is set to UNDEFINED and alt, shift and control are set to false.

ptc::Key::Key (int code)

Creates a key object with the key code set to code.

alt, shift and control are set to false.

Parameters:
code - the key code.

ptc::Key::Key (int code, bool alt, bool shift, bool control)

Creates a key object with the key code set to code and the alt, shift and control modifiers set.

Parameters:
code - the key code
alt - the alt key modifier
shift - the shift key modifier
control - the control key modifier

ptc::Key::Key (const Key & key)

Copy constructor.

ptc::Key::~Key ()

Destructor.

int ptc::Key::code () const

Gets the key code.

See Key::Code for a list of valid key codes.

Returns:
The key code.

bool ptc::Key::alt () const

Gets the alt key modifier.

Returns:
true if the alt key is pressed, false otherwise.

bool ptc::Key::shift () const

Gets the shift key modifier.

Returns:
true if the shift key is pressed, false otherwise.

bool ptc::Key::control () const

Gets the control key modifier.

Returns:
true if the control key is pressed, false otherwise.

Key & ptc::Key::operator= (const Key & key)

Assignment operator.

bool ptc::Key::operator== (const Key & key) const

Equality operator.

bool ptc::Key::operator!= (const Key & key) const

Inequality operator.


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