diff --git a/src/KDFoundation/core_application.cpp b/src/KDFoundation/core_application.cpp index ab26629..5bbef41 100644 --- a/src/KDFoundation/core_application.cpp +++ b/src/KDFoundation/core_application.cpp @@ -73,7 +73,7 @@ CoreApplication::~CoreApplication() ms_application = nullptr; } -void CoreApplication::postEvent(Object *target, std::unique_ptr &&event) +void CoreApplication::postEvent(EventReceiver *target, std::unique_ptr &&event) { assert(target != nullptr); assert(event->type() != Event::Type::Invalid); @@ -81,7 +81,7 @@ void CoreApplication::postEvent(Object *target, std::unique_ptr &&event) m_platformEventLoop->wakeUp(); } -void CoreApplication::sendEvent(Object *target, Event *event) +void CoreApplication::sendEvent(EventReceiver *target, Event *event) { SPDLOG_LOGGER_TRACE(m_logger, "{}()", __FUNCTION__); m_postman->deliverEvent(target, event); @@ -142,5 +142,5 @@ void CoreApplication::event(EventReceiver *target, Event *event) event->setAccepted(true); } - Object::event(target, event); + EventReceiver::event(target, event); } diff --git a/src/KDFoundation/core_application.h b/src/KDFoundation/core_application.h index 49896a3..68d9d30 100644 --- a/src/KDFoundation/core_application.h +++ b/src/KDFoundation/core_application.h @@ -45,10 +45,10 @@ class KDFOUNDATION_API CoreApplication : public Object Postman *postman() { return m_postman.get(); } - void postEvent(Object *target, std::unique_ptr &&event); + void postEvent(EventReceiver *target, std::unique_ptr &&event); EventQueue::size_type eventQueueSize() const { return m_eventQueue.size(); } - void sendEvent(Object *target, Event *event); + void sendEvent(EventReceiver *target, Event *event); void processEvents(int timeout = 0); diff --git a/src/KDFoundation/event.h b/src/KDFoundation/event.h index f926f82..fe9a5ab 100644 --- a/src/KDFoundation/event.h +++ b/src/KDFoundation/event.h @@ -11,6 +11,7 @@ #pragma once +#include "KDFoundation/event_receiver.h" #include #include @@ -81,18 +82,18 @@ class Object; class KDFOUNDATION_API PostedEvent : public Event { public: - PostedEvent(Object *target, std::unique_ptr &&wrappedEvent) + PostedEvent(EventReceiver *target, std::unique_ptr &&wrappedEvent) : Event(Event::Type::PostedEvent) , m_target{ target } , m_wrappedEvent{ std::move(wrappedEvent) } { } - Object *target() const { return m_target; } + EventReceiver *target() const { return m_target; } Event *wrappedEvent() const { return m_wrappedEvent.get(); } private: - Object *m_target; + EventReceiver *m_target; std::unique_ptr m_wrappedEvent; }; diff --git a/src/KDFoundation/event_queue.h b/src/KDFoundation/event_queue.h index 9e570b0..32091c2 100644 --- a/src/KDFoundation/event_queue.h +++ b/src/KDFoundation/event_queue.h @@ -33,7 +33,7 @@ class KDFOUNDATION_API EventQueue m_events.push(std::move(event)); } - void push(Object *target, std::unique_ptr &&event) + void push(EventReceiver *target, std::unique_ptr &&event) { auto ev = std::make_unique(target, std::forward>(event)); push(std::move(ev)); diff --git a/src/KDFoundation/postman.cpp b/src/KDFoundation/postman.cpp index 785ec71..f3f2724 100644 --- a/src/KDFoundation/postman.cpp +++ b/src/KDFoundation/postman.cpp @@ -16,7 +16,7 @@ using namespace KDFoundation; -void Postman::deliverEvent(Object *target, Event *event) +void Postman::deliverEvent(EventReceiver *target, Event *event) { // Give the registered event filters first chance to handle the event for (const auto &filter : m_filters) { diff --git a/src/KDFoundation/postman.h b/src/KDFoundation/postman.h index 1111347..378923c 100644 --- a/src/KDFoundation/postman.h +++ b/src/KDFoundation/postman.h @@ -11,6 +11,7 @@ #pragma once +#include "KDFoundation/event_receiver.h" #include #include @@ -23,7 +24,7 @@ class Object; class KDFOUNDATION_API Postman { public: - void deliverEvent(Object *target, Event *event); + void deliverEvent(EventReceiver *target, Event *event); void addFilter(Object *filter); void removeFilter(Object *filter);