Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Event.h

00001 /*
00002   File: Event.h
00003 
00004   Copyright(C) C. Kotterink, Computed Graphics
00005 */
00006 #ifndef EVENT_H
00007 #define EVENT_H
00008 
00012 class Event
00013 {
00014 public:
00017     typedef enum MouseButton {
00018         LeftButton,     
00019         MiddleButton,   
00020         RightButton     
00021     };
00022 
00025     typedef enum ButtonMask {
00026         // WIN32 compatible values
00027         LeftMask = 1,   
00028         RightMask = 2,  
00029         ShiftMask = 4,  
00030         CtrlMask = 8,   
00031         MiddleMask = 16 
00032     };
00033 
00036     typedef enum Type {
00037         Unkown,         
00038         Key,            
00039         KeyDown,        
00040         KeyUp,          
00041         MouseMove,      
00042         MouseWheel,     
00043         MouseClick,     
00044         MouseRelease    
00045     };
00046 
00048     Event(Type tt = Unkown) : t(tt) {}
00049 
00051     bool isKeyEvent() {
00052        return ((t == Key) || (t == KeyDown) || (t == KeyUp));
00053     }
00054 
00056     bool isMouseEvent() {
00057        return (
00058            (t == MouseMove) || (t == MouseWheel) ||
00059            (t == MouseClick) || (t == MouseRelease));
00060     }
00061 
00063     Event &operator =(Type tt) {
00064         t = tt;
00065         return *this;
00066     }
00067 
00069     bool operator ==(Type tt) {
00070         return t == tt;
00071     }
00072 
00074     bool operator !=(Type tt) {
00075         return t != tt;
00076     }
00077 
00079     Type type() { return t; }
00080 
00081 //protected:
00083     Type t;
00084 
00092     MouseButton button;
00093 
00103     short state;
00104 
00111     short key;
00112 
00114     short x, y;
00115 
00119     short dx, dy;
00120 };
00121 #endif;

This documentation was generated using doxygen. If you have any comments or additions please mail me.