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


Public Methods | |
| MouseEvent (const gadget::EventType type, const gadget::Keys button, int x, int y, int globalX, int globalY, int state, unsigned long time) | |
| Initializes data members. More... | |
| MouseEvent () | |
| Default constructor needed in order to use the templated EventFactory without modification. More... | |
| const gadget::Keys & | getButton () const |
| Get the mouse button that was pressed while generating this event. More... | |
| const int & | getX () const |
| Returns the X corrdinate of the mouse pointer relative to the window. More... | |
| const int & | getY () const |
| Returns the Y corrdinate of the mouse pointer relative to the window. More... | |
| const int & | getGlobalX () const |
| Returns the X corrdinate of the mouse pointer relative to the root window (i.e., the desktop). More... | |
| const int & | getGlobalY () const |
| Returns the Y corrdinate of the mouse pointer relative to the root window (i.e., the desktop). More... | |
| const int & | getState () const |
| Returns the state of the mouse buttons and keyboard modifier keys (CTRL, ALT, and SHIFT). 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... | |
This captures the state of the mouse when any mouse event occurs. This includes button presses, button releases, and mouse motion.
Definition at line 55 of file MouseEvent.h.
|
||||||||||||||||||||||||||||||||||||
|
Initializes data members.
Definition at line 41 of file MouseEvent.cpp.
00044 : gadget::Event(type, time) 00045 , mButton(button) 00046 , mRelativeX(x) 00047 , mRelativeY(y) 00048 , mGlobalX(globalX) 00049 , mGlobalY(globalY) 00050 , mState(state) 00051 { 00052 } |
|
|
Default constructor needed in order to use the templated EventFactory without modification. The EventFactory was needed to allow the correct subtype of Event, MouseEvent in this case, to be created during de-serialization. Definition at line 54 of file MouseEvent.cpp. References gadget::NO_MBUTTON, and gadget::NoEvent.
00055 : gadget::Event(NoEvent, 0) 00056 , mButton(gadget::NO_MBUTTON) 00057 , mRelativeX(0) 00058 , mRelativeY(0) 00059 , mGlobalX(0) 00060 , mGlobalY(0) 00061 , mState(0) 00062 { 00063 } |
|
|
Get the mouse button that was pressed while generating this event.
Definition at line 95 of file MouseEvent.h.
00096 {
00097 return mButton;
00098 }
|
|
|
Returns the X corrdinate of the mouse pointer relative to the window.
Definition at line 103 of file MouseEvent.h.
00104 {
00105 return mRelativeX;
00106 }
|
|
|
Returns the Y corrdinate of the mouse pointer relative to the window.
Definition at line 111 of file MouseEvent.h.
00112 {
00113 return mRelativeY;
00114 }
|
|
|
Returns the X corrdinate of the mouse pointer relative to the root window (i.e., the desktop).
Definition at line 120 of file MouseEvent.h.
00121 {
00122 return mGlobalX;
00123 }
|
|
|
Returns the Y corrdinate of the mouse pointer relative to the root window (i.e., the desktop).
Definition at line 129 of file MouseEvent.h.
00130 {
00131 return mGlobalY;
00132 }
|
|
|
Returns the state of the mouse buttons and keyboard modifier keys (CTRL, ALT, and SHIFT).
Definition at line 140 of file MouseEvent.h.
00141 {
00142 return mState;
00143 }
|
|
|
Serializes this event using the given ObjectWriter.
Reimplemented from gadget::Event. Definition at line 66 of file MouseEvent.cpp. References gadget::Event::mType.
00067 {
00068 writer->writeUint16(mType);
00069
00070 // Serialize all member variables
00071 writer->writeUint32(mButton);
00072 writer->writeUint32(mRelativeX);
00073 writer->writeUint32(mRelativeY);
00074 writer->writeUint32(mGlobalX);
00075 writer->writeUint32(mGlobalY);
00076 writer->writeUint32(mState);
00077
00078 return vpr::ReturnStatus::Succeed;
00079 }
|
|
|
De-serializes this event using the given ObjectReader.
Reimplemented from gadget::Event. Definition at line 82 of file MouseEvent.cpp.
00083 {
00084 // We have already read the type in EventWindoe to decide
00085 // if we should construct a KeyEvent or a MouseEvent
00086 //mType = reader->readUint16();
00087
00088 // De-Serialize all member variables
00089 mButton = (gadget::Keys)reader->readUint32();
00090 mRelativeX = reader->readUint32();
00091 mRelativeY = reader->readUint32();
00092 mGlobalX = reader->readUint32();
00093 mGlobalY = reader->readUint32();
00094 mState = reader->readUint32();
00095 return vpr::ReturnStatus::Succeed;
00096 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002