X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fio%2Feventdispatcher.h;h=b542d67e74d3fa896811b4a04263e9554e4f8902;hb=e9899d5300a1bf3ef72c16b307638dd0a43e11c0;hp=7e89d4739e845f0e0c180845ffedb43184eefd9f;hpb=c7afef88380ebebc8c2b04e48664d73281ec8848;p=libs%2Fcore.git diff --git a/source/io/eventdispatcher.h b/source/io/eventdispatcher.h index 7e89d47..b542d67 100644 --- a/source/io/eventdispatcher.h +++ b/source/io/eventdispatcher.h @@ -1,8 +1,10 @@ -#ifndef EVENTDISPATCHER_H_ -#define EVENTDISPATCHER_H_ +#ifndef MSP_IO_EVENTDISPATCHER_H_ +#define MSP_IO_EVENTDISPATCHER_H_ #include #include +#include +#include #include "poll.h" namespace Msp { @@ -17,23 +19,24 @@ class EventDispatcher: public sigc::trackable private: struct Slot { - Base *obj; + EventObject *obj; sigc::connection evch_conn; sigc::connection del_conn; - Slot(Base *o): obj(o) { } + Slot(EventObject *o): obj(o) { } }; - typedef std::map SlotMap; + typedef std::map SlotMap; Poller poller; SlotMap objects; public: EventDispatcher(); + ~EventDispatcher(); - void add(Base &); - void remove(Base &); + void add(EventObject &); + void remove(EventObject &); /** Checks for and dispatches events. If there are no events available, blocks until there are. */ @@ -43,9 +46,13 @@ public: waits at most the specified time before returning. */ void tick(const Time::TimeDelta &); + /** Checks for and dispatches events. If there are no events available, + waits until the timer's next timeout before returning. */ + void tick(const Time::Timer &); + private: - void object_events_changed(PollEvent, Base *); - void object_deleted(Base *); + void object_events_changed(PollEvent, EventObject *); + void object_deleted(EventObject *); void dispatch(); };