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.
Fork of SimpleGUI by
EventHandler.h
00001 #ifndef SIMPLEGUI_EVENT_HANDLER_H 00002 #define SIMPLEGUI_EVENT_HANDLER_H 00003 00004 #include "Event.h" 00005 #include "EventHandlerFunction.h" 00006 00007 class EventHandler { 00008 00009 public: 00010 00011 EventHandler(EventType eventType, EventHandlerFunction fn) : type(eventType) 00012 { 00013 _fp.attach(fn); 00014 } 00015 00016 00017 template<typename T> 00018 EventHandler(EventType eventType, T* tptr, void (T::*mptr)(Event)) : type(eventType) 00019 { 00020 _fp.attach(tptr, mptr); 00021 } 00022 00023 void handle(Event e) { 00024 _fp.call(e); 00025 } 00026 00027 EventType type; 00028 FunctionPointerArg1<void,Event> _fp; 00029 }; 00030 00031 class EventHandlerList { 00032 00033 public: 00034 00035 EventHandlerList(EventHandler* eventHandler) : handler(eventHandler), next(NULL), prev(NULL) 00036 { 00037 } 00038 00039 EventHandler *handler; 00040 EventHandlerList *next; 00041 EventHandlerList *prev; 00042 00043 }; 00044 00045 #endif
Generated on Tue Jul 12 2022 22:27:14 by
