00001 #ifndef CEVENT_H 00002 #define CEVENT_H 00003 00017 #include "csingletonmanager.h" 00018 00019 #include <assert.h> 00020 00024 class CEvent { 00025 public: 00027 static const int TYPE_KEY_DOWN = 1; 00028 00031 static const int TYPE_APPLICATION_EXIT = 2; 00032 public: 00033 virtual ~CEvent() { } 00034 00037 virtual int is_ctrl_pressed() = 0; 00038 00041 virtual char get_key_ascii_value() = 0; 00042 00044 virtual int get_type() = 0; 00045 }; 00046 00050 class CEventSystem { 00051 private: 00052 /* Outlaw copy constructor and '=' operator. */ 00053 CEventSystem(CEventSystem &); 00054 CEventSystem &operator=(CEventSystem &); 00055 00056 public: 00057 CEventSystem() { } 00058 virtual ~CEventSystem() { } 00059 00063 virtual CEvent *get_next_event() = 0; 00064 }; 00065 00067 class CEventSystemManager : public CSingletonManager<CEventSystem> { }; 00068 00070 typedef CSingletonFactory<CEventSystem> CEventSystemFactory; 00071 00072 #endif
1.3.3