Line | |
---|
1 | /*! |
---|
2 | * @file event_listener.h |
---|
3 | * Definition of an event listener base class |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _EVENT_LISTENER_H |
---|
7 | #define _EVENT_LISTENER_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | #include "event_def.h" |
---|
11 | #include "event.h" |
---|
12 | |
---|
13 | //! A class for event listener |
---|
14 | class EventListener : virtual public BaseObject |
---|
15 | { |
---|
16 | ObjectListDeclaration(EventListener); |
---|
17 | public: |
---|
18 | EventListener(); |
---|
19 | virtual ~EventListener(); |
---|
20 | |
---|
21 | bool isEventSubscribed(elState state, int eventType) const; |
---|
22 | |
---|
23 | void subscribeEvent(elState state, int eventType); |
---|
24 | void unsubscribeEvent(elState state, int eventType); |
---|
25 | void unsubscribeEvents(elState state = ES_ALL); |
---|
26 | |
---|
27 | /** |
---|
28 | * @brief abstract function that processes events from the handler |
---|
29 | * @param event: the event |
---|
30 | */ |
---|
31 | virtual void process(const Event &event) = 0; |
---|
32 | |
---|
33 | }; |
---|
34 | |
---|
35 | #endif /* _EVENT_LISTENER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.