rag
graphic 2d engine
EventDispatcher.h
1 #ifndef Rag_EventDispatcher_h
2 #define Rag_EventDispatcher_h
3 
4 #include <string>
5 #include "EventListener.h"
6 #include "Event.h"
7 #include <map>
8 #include <vector>
9 
10 namespace events
11 {
13 
15  {
16  public:
17 
19  virtual ~EventDispatcher(){};
20 
21  void addEventListener(std::string type, EventListener* listener);
22  void dispatchEvent(Event& event);
23  bool hasEventListener(std::string type);
24  void removeEventListener(std::string type, EventListener* listener);
25 
26  private:
27 
28  std::map<std::string, std::vector<EventListener*> > listeners;
29 
30  };
31 }
32 
33 
34 #endif
Base class for event system.
Definition: Event.h:24
Base class used to dispatch events.
Definition: EventDispatcher.h:14
Interface that allows to listen events.
Definition: EventListener.h:10
Definition: Event.h:11