27 #ifndef _CEGUISubscriberSlot_h_
28 #define _CEGUISubscriberSlot_h_
30 #include "CEGUI/Base.h"
31 #include "CEGUI/FreeFunctionSlot.h"
32 #include "CEGUI/FunctorCopySlot.h"
33 #include "CEGUI/FunctorReferenceSlot.h"
34 #include "CEGUI/FunctorPointerSlot.h"
35 #include "CEGUI/MemberFunctionSlot.h"
36 #include "CEGUI/FunctorReferenceBinder.h"
51 class CEGUIEXPORT SubscriberSlot :
52 public AllocatedObject<SubscriberSlot>
75 d_functor_impl(CEGUI_NEW_AO FreeFunctionSlotVoid(func))
86 d_functor_impl(CEGUI_NEW_AO FreeFunctionSlotNoArgs(func))
97 d_functor_impl(CEGUI_NEW_AO FreeFunctionSlotVoidNoArgs(func))
113 bool operator()(
const EventArgs& args)
const
115 return (*d_functor_impl)(args);
122 bool connected()
const
124 return d_functor_impl != 0;
140 SubscriberSlot(
bool (T::*
function)(
const EventArgs&), T* obj) :
141 d_functor_impl(new MemberFunctionSlot<T>(function, obj))
149 SubscriberSlot(
void (T::*
function)(
const EventArgs&), T* obj) :
150 d_functor_impl(new MemberFunctionSlotVoid<T>(function, obj))
158 SubscriberSlot(
bool (T::*
function)(), T* obj) :
159 d_functor_impl(new MemberFunctionSlotNoArgs<T>(function, obj))
167 SubscriberSlot(
void (T::*
function)(), T* obj) :
168 d_functor_impl(new MemberFunctionSlotVoidNoArgs<T>(function, obj))
176 SubscriberSlot(
const FunctorReferenceBinder<T>& binder) :
177 d_functor_impl(new FunctorReferenceSlot<T>(binder.d_functor))
185 SubscriberSlot(
const T& functor) :
186 d_functor_impl(new FunctorCopySlot<T>(functor))
194 SubscriberSlot(T* functor) :
195 d_functor_impl(new FunctorPointerSlot<T>(functor))
205 #endif // end of guard _CEGUISubscriberSlot_h_