#include <KeyEvent.h>
Inheritance diagram for gadget::KeyEvent:


Public Methods | |
| KeyEvent (const gadget::EventType type, const gadget::Keys key, int mask, unsigned long time, char asciiKey=0) | |
| Initializes data members. More... | |
| KeyEvent () | |
| Default constructor needed in order to use the templated EventFactory without modification. More... | |
| const gadget::Keys & | getKey () const |
| Get the key that was pressed while generating this event. More... | |
| const int & | getModifierMask () const |
| Returns the modifier mask for this event. More... | |
| const char & | getKeyChar () const |
| Returns the ASCII character corresponding to the key that was pressed. More... | |
| virtual vpr::ReturnStatus | writeObject (vpr::ObjectWriter *writer) |
| Serializes this event using the given ObjectWriter. More... | |
| virtual vpr::ReturnStatus | readObject (vpr::ObjectReader *reader) |
| De-serializes this event using the given ObjectReader. More... | |
Protected Attributes | |
| gadget::Keys | mKey |
| The actual key pressed. More... | |
| int | mModifierMask |
| The mask of any modifiers in addition to mKey. More... | |
| char | mAsciiKey |
| ASCCI representation of key pressed. More... | |
Definition at line 53 of file KeyEvent.h.
|
||||||||||||||||||||||||
|
Initializes data members.
Definition at line 43 of file KeyEvent.cpp.
00045 : gadget::Event(type, time) 00046 , mKey(key) 00047 , mModifierMask(mask) 00048 , mAsciiKey(asciiKey) 00049 { 00050 } |
|
|
Default constructor needed in order to use the templated EventFactory without modification. The EventFactory was needed to allow the correct subtype of Event, KeyEvent in this case, to be created during de-serialization. Definition at line 52 of file KeyEvent.cpp. References gadget::KEY_SPACE, and gadget::NoEvent.
00053 : gadget::Event(NoEvent, 0) 00054 , mKey(gadget::KEY_SPACE) 00055 , mModifierMask(0) 00056 , mAsciiKey(' ') 00057 { 00058 } |
|
|
Get the key that was pressed while generating this event.
Definition at line 91 of file KeyEvent.h.
00092 {
00093 return mKey;
00094 }
|
|
|
Returns the modifier mask for this event. This tells which modifier keys (if any) were pressed at the same time as the key that was pressed or released. The mask is the bitwise OR of values in the enumeration gadget::ModifierMask.
Definition at line 104 of file KeyEvent.h.
00105 {
00106 return mModifierMask;
00107 }
|
|
|
Returns the ASCII character corresponding to the key that was pressed.
Definition at line 112 of file KeyEvent.h.
00113 {
00114 return mAsciiKey;
00115 }
|
|
|
Serializes this event using the given ObjectWriter.
Reimplemented from gadget::Event. Definition at line 61 of file KeyEvent.cpp. References mAsciiKey, mKey, mModifierMask, gadget::Event::mTime, and gadget::Event::mType.
00062 {
00063 writer->writeUint16(mType);
00064
00065 // Serialize all member variables
00066 writer->writeUint32(mKey);
00067 writer->writeUint32(mModifierMask);
00068 writer->writeUint64(mTime);
00069 writer->writeUint8(mAsciiKey);
00070
00071 return vpr::ReturnStatus::Succeed;
00072 }
|
|
|
De-serializes this event using the given ObjectReader.
Reimplemented from gadget::Event. Definition at line 75 of file KeyEvent.cpp. References mAsciiKey, mKey, mModifierMask, and gadget::Event::mTime.
00076 {
00077 // We have already read the type in EventWindow to decide
00078 // if we should construct a KeyEvent or a MouseEvent
00079 //mType = reader->readUint16();
00080
00081 // De-Serialize all member variables
00082 mKey = (gadget::Keys)reader->readUint32();
00083 mModifierMask = reader->readUint32();
00084 mTime = reader->readUint64();
00085 mAsciiKey = reader->readUint8();
00086 return vpr::ReturnStatus::Succeed;
00087 }
|
|
|
The actual key pressed.
Definition at line 128 of file KeyEvent.h. Referenced by readObject, and writeObject. |
|
|
The mask of any modifiers in addition to mKey.
Definition at line 129 of file KeyEvent.h. Referenced by readObject, and writeObject. |
|
|
ASCCI representation of key pressed.
Definition at line 130 of file KeyEvent.h. Referenced by readObject, and writeObject. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002