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>
7 #include <msp/time/timer.h>
14 Put your I/O objects inside one of these to get signaled when something happens
17 class EventDispatcher: public sigc::trackable
23 sigc::connection evch_conn;
24 sigc::connection del_conn;
26 Slot(EventObject *o): obj(o) { }
29 typedef std::map<EventObject *, Slot> SlotMap;
38 void add(EventObject &);
39 void remove(EventObject &);
41 /** Checks for and dispatches events. If there are no events available,
42 blocks until there are. */
45 /** Checks for and dispatches events. If there are no events available,
46 waits at most the specified time before returning. */
47 void tick(const Time::TimeDelta &);
49 /** Checks for and dispatches events. If there are no events available,
50 waits until the timer's next timeout before returning. */
51 void tick(const Time::Timer &);
54 void object_events_changed(PollEvent, EventObject *);
55 void object_deleted(EventObject *);