1 #ifndef MSP_IO_EVENTDISPATCHER_H_
2 #define MSP_IO_EVENTDISPATCHER_H_
4 #include <sigc++/connection.h>
5 #include <sigc++/trackable.h>
6 #include <msp/time/timedelta.h>
13 Put your I/O objects inside one of these to get signaled when something happens
16 class EventDispatcher: public sigc::trackable
22 sigc::connection evch_conn;
23 sigc::connection del_conn;
25 Slot(EventObject *o): obj(o) { }
28 typedef std::map<EventObject *, Slot> SlotMap;
37 void add(EventObject &);
38 void remove(EventObject &);
40 /** Checks for and dispatches events. If there are no events available,
41 blocks until there are. */
44 /** Checks for and dispatches events. If there are no events available,
45 waits at most the specified time before returning. */
46 void tick(const Time::TimeDelta &);
49 void object_events_changed(PollEvent, EventObject *);
50 void object_deleted(EventObject *);