24 #ifndef __IEventDispatcher__ 25 #define __IEventDispatcher__ 27 #include "IPMUnknown.h" 28 #include "ShuksanID.h" 41 enum { kDefaultIID = IID_IEVENTDISPATCHER };
67 virtual int32
Depth()
const = 0;
72 virtual void Init() = 0;
84 virtual bool16
DispatchEvent(
IEvent *theEvent, IEvent::SystemHandledState initialState = IEvent::kShouldCall) = 0;
86 #define ITERATOR_ACCESS_TO_EventTypeList 0 87 #if 0 //VC can't cope with this 92 protected:
static uint32 GetEventTypeListContents( EventTypeList l){
return l.fContents;}
98 #if 0 //VC can't cope with this 99 friend uint32 IEventDispatcher::GetEventTypeListContents(
EventTypeList l);
102 enum {kMaxEventTypeValue = 31};
104 fContents = kAllEventTypes;
110 fContents = 1<<t1 | 1<<t2;
113 fContents = 1<<t1 | 1<<t2 | 1<<t3;
124 bool16 Empty(){
return fContents == 0;}
125 #if ITERATOR_ACCESS_TO_EventTypeList 126 class const_iterator {
129 const_iterator(
const EventTypeList::const_iterator& x) : next(x.next), rest(x.rest) {}
131 const_iterator& operator++()
135 }
while( (rest >>= 1) && !(rest&1));
138 const_iterator operator++(
int) {const_iterator old(*
this); operator++();
return old;}
139 friend bool operator==(const_iterator x, const_iterator y) {
return x.rest == y.rest;}
140 friend bool operator!=(const_iterator x, const_iterator y) {
return x.rest != y.rest;}
143 const_iterator(uint32 contents) : next(0), rest(contents)
153 const_iterator begin()
const {
return const_iterator(fContents);}
154 const_iterator end()
const {
return const_iterator(0);}
168 virtual void StopAllEventWatchers() = 0;
173 #endif // __IEventDispatcher__