|
Last change
on this file since 5175 was
5093,
checked in by bensch, 20 years ago
|
|
orxonox/trunk: inputLine is working.
|
|
File size:
1.5 KB
|
| Rev | Line | |
|---|
| [4780] | 1 | /*! |
|---|
| [5039] | 2 | * @file event_handler.h |
|---|
| 3 | * Definition of the EventHandler |
|---|
| 4 | * |
|---|
| 5 | */ |
|---|
| [4780] | 6 | |
|---|
| [4346] | 7 | #ifndef _EVENT_HANDLER_H |
|---|
| 8 | #define _EVENT_HANDLER_H |
|---|
| [4329] | 9 | |
|---|
| 10 | #include "base_object.h" |
|---|
| [4405] | 11 | #include "key_mapper.h" |
|---|
| [4352] | 12 | #include "event_def.h" |
|---|
| [4329] | 13 | |
|---|
| [4834] | 14 | // FORWARD DECLARATION |
|---|
| [4346] | 15 | class EventListener; |
|---|
| [4834] | 16 | template <class T> class tList; |
|---|
| [4866] | 17 | class IniParser; |
|---|
| [4329] | 18 | |
|---|
| [4346] | 19 | //! The one Event Handler from Orxonox |
|---|
| 20 | class EventHandler : public BaseObject { |
|---|
| 21 | |
|---|
| [4329] | 22 | public: |
|---|
| [4746] | 23 | virtual ~EventHandler(); |
|---|
| [4836] | 24 | /** @returns a Pointer to the only object of this Class */ |
|---|
| [4746] | 25 | inline static EventHandler* getInstance() { if (!singletonRef) singletonRef = new EventHandler(); return singletonRef; }; |
|---|
| [4866] | 26 | void init(IniParser* iniParser); |
|---|
| [4407] | 27 | |
|---|
| [5093] | 28 | /** @param state: to which the event handler shall change */ |
|---|
| 29 | inline void setState(elState state) { this->state = state; }; |
|---|
| 30 | /** @returns the current state */ |
|---|
| 31 | inline elState getState() const { return this->state; }; |
|---|
| [4350] | 32 | |
|---|
| [4405] | 33 | void subscribe(EventListener* el, elState state, int eventType); |
|---|
| [4419] | 34 | void unsubscribe(elState state, int eventType); |
|---|
| [4420] | 35 | void unsubscribe(EventListener* el, elState state = ES_ALL); |
|---|
| [4364] | 36 | void flush(elState state); |
|---|
| [4346] | 37 | |
|---|
| [4352] | 38 | void process(); |
|---|
| [4346] | 39 | |
|---|
| [4872] | 40 | void debug() const; |
|---|
| 41 | |
|---|
| [4329] | 42 | private: |
|---|
| [4746] | 43 | EventHandler(); |
|---|
| [4352] | 44 | |
|---|
| [4780] | 45 | |
|---|
| [4368] | 46 | private: |
|---|
| [4780] | 47 | static EventHandler* singletonRef; //!< the singleton reference |
|---|
| 48 | |
|---|
| 49 | EventListener*** listeners; //!< a list of registered listeners |
|---|
| 50 | elState state; //!< the state of the event handlder |
|---|
| 51 | KeyMapper* keyMapper; //!< reference to the key mapper |
|---|
| [4329] | 52 | }; |
|---|
| 53 | |
|---|
| [4346] | 54 | #endif /* _EVENT_HANDLER_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.