2 #include "oxygine-include.h" 4 #include "core/Object.h" 5 #include "closure/closure.h" 9 #define makefourcc(a,b,c,d) ( ((unsigned int)a) | (((unsigned int)b)<< 8) | (((unsigned int)c)<<16) | (((unsigned int)d)<<24)) 12 inline int error_eventID_should_be_size_of_4_chars(
int x) {
return x; }
13 constexpr
size_t constStringLength(
const char* str) {
return (*str == 0) ? 0 : constStringLength(str + 1) + 1; }
14 constexpr
int EventIDc11(
const char* str) {
return constStringLength(str) == 4 ? makefourcc(str[0], str[1], str[2], str[3]) : error_eventID_should_be_size_of_4_chars(0); }
18 #define eventID(a,b,c,d) makefourcc(a,b,c,d) 21 #define sysEventID(b,c,d) makefourcc(0xA,b,c,d) 23 #define EventID(str) EventIDc11(str) 26 DECLARE_SMART(EventDispatcher, spEventDispatcher);
35 int addEventListener(eventType,
const EventCallback&);
55 virtual void dispatchEvent(
Event* event);
57 int getListenersCount()
const;
58 int getLastListenerID()
const {
return _lastID; }
60 const EventCallback& getListenerByIndex(
int index)
const {
return (*_listeners)[index].cb; }
78 typedef std::vector<listener> listeners;
79 listeners* _listeners;
void removeEventListeners(void *CallbackThis)
void removeAllEventListeners()
bool hasEventListeners(void *CallbackThis)
–oxgl-end–!
Definition: Actor.h:14
Definition: EventDispatcher.h:65
Definition: EventDispatcher.h:71
void removeEventListener(eventType, const EventCallback &)
Definition: EventDispatcher.h:27