Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Events/EventDispatcher.h@0:0a590815d51c, 2016-03-25 (annotated)
- Committer:
- duncanFrance
- Date:
- Fri Mar 25 13:47:04 2016 +0000
- Revision:
- 0:0a590815d51c
- Child:
- 12:63db16fea709
Added EventSource interface
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
duncanFrance | 0:0a590815d51c | 1 | #ifndef SIMPLEGUI_EVENT_DISPATCHER_H |
duncanFrance | 0:0a590815d51c | 2 | #define SIMPLEGUI_EVENT_DISPATCHER_H |
duncanFrance | 0:0a590815d51c | 3 | |
duncanFrance | 0:0a590815d51c | 4 | #include "EventListener.h" |
duncanFrance | 0:0a590815d51c | 5 | |
duncanFrance | 0:0a590815d51c | 6 | class EventListenerWrapper { |
duncanFrance | 0:0a590815d51c | 7 | |
duncanFrance | 0:0a590815d51c | 8 | public: |
duncanFrance | 0:0a590815d51c | 9 | |
duncanFrance | 0:0a590815d51c | 10 | EventListenerWrapper(EventListener* l) : listener(l), prev(NULL), next(NULL) {} |
duncanFrance | 0:0a590815d51c | 11 | |
duncanFrance | 0:0a590815d51c | 12 | EventListener* listener; |
duncanFrance | 0:0a590815d51c | 13 | EventListenerWrapper* prev; |
duncanFrance | 0:0a590815d51c | 14 | EventListenerWrapper* next; |
duncanFrance | 0:0a590815d51c | 15 | }; |
duncanFrance | 0:0a590815d51c | 16 | |
duncanFrance | 0:0a590815d51c | 17 | class EventDispatcher { |
duncanFrance | 0:0a590815d51c | 18 | |
duncanFrance | 0:0a590815d51c | 19 | |
duncanFrance | 0:0a590815d51c | 20 | public: |
duncanFrance | 0:0a590815d51c | 21 | |
duncanFrance | 0:0a590815d51c | 22 | EventDispatcher(); |
duncanFrance | 0:0a590815d51c | 23 | |
duncanFrance | 0:0a590815d51c | 24 | void attachListener(EventListener* l); |
duncanFrance | 0:0a590815d51c | 25 | void detachListener(EventListener* l); |
duncanFrance | 0:0a590815d51c | 26 | void dispatchEvent(Event e); |
duncanFrance | 0:0a590815d51c | 27 | |
duncanFrance | 0:0a590815d51c | 28 | private: |
duncanFrance | 0:0a590815d51c | 29 | |
duncanFrance | 0:0a590815d51c | 30 | EventListenerWrapper* _listeners; |
duncanFrance | 0:0a590815d51c | 31 | |
duncanFrance | 0:0a590815d51c | 32 | }; |
duncanFrance | 0:0a590815d51c | 33 | |
duncanFrance | 0:0a590815d51c | 34 | #endif |