Foundation classes for a basic GUI implementing simple widgets and events
Dependents: TouchScreenGUIDemo
Events/EventHandler.h
- Committer:
- duncanFrance
- Date:
- 2016-05-28
- Revision:
- 18:d849f3ada858
- Parent:
- 12:63db16fea709
File content as of revision 18:d849f3ada858:
#ifndef SIMPLEGUI_EVENT_HANDLER_H #define SIMPLEGUI_EVENT_HANDLER_H #include "Event.h" #include "EventHandlerFunction.h" class EventHandler { public: EventHandler(EventType eventType, EventHandlerFunction fn) : type(eventType) { _fp.attach(fn); } template<typename T> EventHandler(EventType eventType, T* tptr, void (T::*mptr)(Event)) : type(eventType) { _fp.attach(tptr, mptr); } void handle(Event e) { _fp.call(e); } EventType type; FunctionPointerArg1<void,Event> _fp; }; class EventHandlerList { public: EventHandlerList(EventHandler* eventHandler) : handler(eventHandler), next(NULL), prev(NULL) { } EventHandler *handler; EventHandlerList *next; EventHandlerList *prev; }; #endif