Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/event/event_handler.h @ 5291

Last change on this file since 5291 was 5237, checked in by bensch, 19 years ago

orxonox/trunk: implemented an EventFilter, that should filter alt-TAB

File size: 1.6 KB
Line 
1/*!
2 * @file event_handler.h
3 * 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// FORWARD DECLARATION
15class EventListener;
16template <class T> class tList;
17class IniParser;
18
19//! The one Event Handler from Orxonox
20class EventHandler : public BaseObject {
21
22 public:
23  virtual ~EventHandler();
24  /** @returns a Pointer to the only object of this Class */
25  inline static EventHandler* getInstance() { if (!singletonRef) singletonRef = new EventHandler();  return singletonRef; };
26  void init(IniParser* iniParser);
27
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; };
32
33  void subscribe(EventListener* el, elState state, int eventType);
34  void unsubscribe(elState state, int eventType);
35  void unsubscribe(EventListener* el, elState state = ES_ALL);
36  void flush(elState state);
37
38  void process();
39
40  static int eventFilter(const SDL_Event *event);
41  void debug() const;
42
43 private:
44  EventHandler();
45
46
47 private:
48  static EventHandler*       singletonRef;                    //!< the singleton reference
49
50  EventListener*             listeners[ES_NUMBER][EV_NUMBER]; //!< a list of registered listeners
51  elState                    state;                           //!< the state of the event handlder
52  KeyMapper*                 keyMapper;                       //!< reference to the key mapper
53};
54
55
56#endif /* _EVENT_HANDLER_H */
Note: See TracBrowser for help on using the repository browser.