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;
36 void add(EventObject &);
37 void remove(EventObject &);
39 /** Checks for and dispatches events. If there are no events available,
40 blocks until there are. */
43 /** Checks for and dispatches events. If there are no events available,
44 waits at most the specified time before returning. */
45 void tick(const Time::TimeDelta &);
48 void object_events_changed(PollEvent, EventObject *);
49 void object_deleted(EventObject *);