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
- enum Code { ENTER,
BACKSPACE,
TAB,
CANCEL,
CLEAR,
SHIFT,
CONTROL,
ALT,
PAUSE,
CAPSLOCK,
ESCAPE,
SPACE,
PAGEUP,
PAGEDOWN,
END,
HOME,
LEFT,
UP,
RIGHT,
DOWN,
COMMA,
PERIOD,
SLASH,
ZERO,
ONE,
TWO,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
SEMICOLON,
EQUALS,
A,
B,
C,
D,
E,
F,
G,
H,
I,
J,
K,
L,
M,
N,
O,
P,
Q,
R,
S,
T,
U,
V,
W,
X,
Y,
Z,
OPENBRACKET,
BACKSLASH,
CLOSEBRACKET,
NUMPAD0,
NUMPAD1,
NUMPAD2,
NUMPAD3,
NUMPAD4,
NUMPAD5,
NUMPAD6,
NUMPAD7,
NUMPAD8,
NUMPAD9,
MULTIPLY,
ADD,
SEPARATOR,
SUBTRACT,
DECIMAL,
DIVIDE,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
DELETE,
NUMLOCK,
SCROLLLOCK,
PRINTSCREEN,
INSERT,
HELP,
META,
BACKQUOTE,
QUOTE,
FINAL,
CONVERT,
NONCONVERT,
ACCEPT,
MODECHANGE,
KANA,
KANJI,
UNDEFINED
}
- Key ()
- Key (int code)
- Key (int code,bool alt,bool shift,bool control)
- Key (const Key &key)
- ~Key ()
- int code () const
- bool alt () const
- bool shift () const
- bool control () const
- Key& operator= (const Key &key)
- bool operator== (const Key &key) const
- bool operator!= (const Key &key) const
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:
- ENTER
- BACKSPACE
- TAB
- CANCEL
- CLEAR
- SHIFT
- CONTROL
- ALT
- PAUSE
- CAPSLOCK
- ESCAPE
- SPACE
- PAGEUP
- PAGEDOWN
- END
- HOME
- LEFT
- UP
- RIGHT
- DOWN
- COMMA
- PERIOD
- SLASH
- ZERO
- ONE
- TWO
- THREE
- FOUR
- FIVE
- SIX
- SEVEN
- EIGHT
- NINE
- SEMICOLON
- EQUALS
- A
- B
- C
- D
- E
- F
- G
- H
- I
- J
- K
- L
- M
- N
- O
- P
- Q
- R
- S
- T
- U
- V
- W
- X
- Y
- Z
- OPENBRACKET
- BACKSLASH
- CLOSEBRACKET
- NUMPAD0
- NUMPAD1
- NUMPAD2
- NUMPAD3
- NUMPAD4
- NUMPAD5
- NUMPAD6
- NUMPAD7
- NUMPAD8
- NUMPAD9
- MULTIPLY
- ADD
- SEPARATOR
- SUBTRACT
- DECIMAL
- DIVIDE
- F1
- F2
- F3
- F4
- F5
- F6
- F7
- F8
- F9
- F10
- F11
- F12
- DELETE
- NUMLOCK
- SCROLLLOCK
- PRINTSCREEN
- INSERT
- HELP
- META
- BACKQUOTE
- QUOTE
- FINAL
- CONVERT
- NONCONVERT
- ACCEPT
- MODECHANGE
- KANA
- KANJI
- UNDEFINED
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)
ptc::Key::~Key ()
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)
bool ptc::Key::operator== (const Key & key) const
bool ptc::Key::operator!= (const Key & key) const
The documentation for this class was generated from the following file: