00001 // Class QEvent 00002 // Filename QEvent.h 00003 // FaPra 2003-2004, A5, Alexander Kramer 00004 00005 #ifndef QEvent_h 00006 #define QEvent_h 00007 00008 00009 //! Pre-declaration of QEvent 00010 class QEvent; 00011 00012 00013 //! enumeration of events 00014 enum QEventType {etDraw, etMouseDown, etMouseUp, etMouseMotion, etMouseClick, etKeyboard, etKeyboardUp, etSpecialKey }; 00015 00016 //! enumeration of mouse buttons 00017 enum QMouseButton {mbLeft, mbCenter, mbRight}; 00018 00019 00020 //! Event class, which holds the events 00021 class QEvent 00022 { 00023 protected: 00024 //! type of event 00025 QEventType Type; 00026 00027 //! mouse button 00028 QMouseButton Button; 00029 00030 //! mouse button x coordinate 00031 int X; 00032 00033 //! mouse button y coordinate 00034 int Y; 00035 00036 //! keyboard key 00037 int Key; 00038 00039 public: 00040 //! getter method for Type 00041 virtual QEventType getType(); 00042 00043 //! setter method for Type 00044 virtual void setType( QEventType newValue ); 00045 00046 //! getter method for Button 00047 virtual QMouseButton getButton(); 00048 00049 //! setter method for Button 00050 virtual void setButton( QMouseButton newValue ); 00051 00052 //! getter method for X 00053 virtual int getX(); 00054 00055 //! setter method for X 00056 virtual void setX( int newValue ); 00057 00058 //! getter method for Y 00059 virtual int getY(); 00060 00061 //! setter method for Y 00062 virtual void setY( int newValue ); 00063 00064 //! getter method for Key 00065 virtual int getKey(); 00066 00067 //! setter method for Key 00068 virtual void setKey( int newValue ); 00069 00070 //! copy itself from another instance 00071 void copyFrom( QEvent* from ); 00072 00073 //! prints itself to the cout 00074 void print(); 00075 00076 //! Constructor 00077 QEvent( ); 00078 00079 //! Destructor 00080 virtual ~QEvent(); 00081 00082 00083 }; 00084 #endif 00085
1.2.18