#include "iMouseListener.h" IMouseListener::~IMouseListener() { unsubscribeEvents(); } void IMouseListener::subscribeEvents(int listenerId) { mouseClickHandler = [this](const MouseClickEvent & event) { this->onMouseClicked(event); }; mousePressHandler = [this](const MousePressedEvent & event) { this->onMousePressed(event); }; mouseReleaseHandler = [this](const MouseReleasedEvent & event) { this->onMouseReleased(event); }; mouseMoveHandler = [this](const MouseMovedEvent & event) { this->onMouseMoved(event); }; subscribe(mouseClickHandler, listenerId); subscribe(mousePressHandler, listenerId); subscribe(mouseReleaseHandler, listenerId); subscribe(mouseMoveHandler, listenerId); } void IMouseListener::unsubscribeEvents(int listenerId) { unsubscribe(mouseClickHandler, listenerId); unsubscribe(mousePressHandler, listenerId); unsubscribe(mouseReleaseHandler, listenerId); unsubscribe(mouseMoveHandler, listenerId); }