|
Last change
on this file since 4510 was
4457,
checked in by patrick, 20 years ago
|
|
orxonox/trunk: moved util/event to lib/event
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | \file event_handler.h |
|---|
| 3 | \brief Definition of the EventHandler |
|---|
| 4 | |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| 7 | #ifndef _EVENT_HANDLER_H |
|---|
| 8 | #define _EVENT_HANDLER_H |
|---|
| 9 | |
|---|
| 10 | #include "base_object.h" |
|---|
| 11 | #include "key_mapper.h" |
|---|
| 12 | #include "event_def.h" |
|---|
| 13 | |
|---|
| 14 | class EventListener; |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | //! The one Event Handler from Orxonox |
|---|
| 18 | class EventHandler : public BaseObject { |
|---|
| 19 | |
|---|
| 20 | public: |
|---|
| 21 | static EventHandler* getInstance(void); |
|---|
| 22 | virtual ~EventHandler(void); |
|---|
| 23 | void init(); |
|---|
| 24 | |
|---|
| 25 | void setState(elState state); |
|---|
| 26 | |
|---|
| 27 | void subscribe(EventListener* el, elState state, int eventType); |
|---|
| 28 | void unsubscribe(elState state, int eventType); |
|---|
| 29 | void unsubscribe(EventListener* el, elState state = ES_ALL); |
|---|
| 30 | void flush(elState state); |
|---|
| 31 | |
|---|
| 32 | void process(); |
|---|
| 33 | |
|---|
| 34 | private: |
|---|
| 35 | EventHandler(void); |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | private: |
|---|
| 39 | static EventHandler* singletonRef; //!< the singleton reference |
|---|
| 40 | EventListener*** listeners; //!< a list of registered listeners |
|---|
| 41 | elState state; //!< the state of the event handlder |
|---|
| 42 | KeyMapper* keyMapper; //!< reference to the key mapper |
|---|
| 43 | }; |
|---|
| 44 | |
|---|
| 45 | #endif /* _EVENT_HANDLER_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.