Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CS_IUTIL_EVENTH_H__
00020 #define __CS_IUTIL_EVENTH_H__
00021
00029 #include "csutil/scf_interface.h"
00030 #include "iutil/eventnames.h"
00031 #include "iutil/eventhandlers.h"
00032
00033 struct iEvent;
00034
00035
00039 struct iEventHandler : public virtual iBase
00040 {
00041 SCF_INTERFACE(iEventHandler, 2,0,0);
00054 virtual bool HandleEvent (iEvent&) = 0;
00055
00080 virtual const char * GenericName() const = 0;
00081
00093 virtual csHandlerID GenericID (
00094 csRef<iEventHandlerRegistry> &) const = 0;
00095
00096
00108 virtual const csHandlerID * GenericPrec (
00109 csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &,
00110 csEventID) const = 0;
00111
00123 virtual const csHandlerID * GenericSucc (
00124 csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &,
00125 csEventID) const = 0;
00126
00139 virtual const csHandlerID * InstancePrec (
00140 csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &,
00141 csEventID) const = 0;
00142
00155 virtual const csHandlerID * InstanceSucc (
00156 csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &,
00157 csEventID) const = 0;
00158 };
00159
00165 #define CS_EVENTHANDLER_NAMES(x) \
00166 static const char * StaticHandlerName() \
00167 { return (x); } \
00168 static const csHandlerID StaticID(csRef<iEventHandlerRegistry> ®) \
00169 {return reg->GetGenericID(StaticHandlerName()); } \
00170 virtual const char * GenericName() const \
00171 { return StaticHandlerName(); } \
00172 virtual csHandlerID GenericID(csRef<iEventHandlerRegistry> ®) const \
00173 { return StaticID(reg); }
00174
00178 #define CS_EVENTHANDLER_NIL_CONSTRAINTS \
00179 CS_EVENTHANDLER_NIL_GENERIC_CONSTRAINTS \
00180 CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS
00181
00185 #define CS_EVENTHANDLER_NIL_GENERIC_CONSTRAINTS \
00186 virtual const csHandlerID * GenericPrec ( \
00187 csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &, \
00188 csEventID) const { return 0; } \
00189 virtual const csHandlerID * GenericSucc ( \
00190 csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &, \
00191 csEventID) const { return 0; }
00192
00196 #define CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS \
00197 virtual const csHandlerID * InstancePrec ( \
00198 csRef<iEventHandlerRegistry> &r1, csRef<iEventNameRegistry> &r2, \
00199 csEventID e) const { return GenericPrec(r1, r2, e); } \
00200 virtual const csHandlerID * InstanceSucc ( \
00201 csRef<iEventHandlerRegistry> &r1, csRef<iEventNameRegistry> &r2, \
00202 csEventID e) const { return GenericSucc(r1, r2, e); }
00203
00206 #endif // __CS_IUTIL_EVENTH_H__