Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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