Abstract interface for event handling. More...
#include <gui_eventreceiver.hpp>
Public Member Functions | |
event_receiver (event_manager *mManager=nullptr) | |
Constructor. | |
virtual | ~event_receiver () |
Destructor. | |
virtual void | on_event (const event &mEvent)=0 |
Called whenever an Event occurs. | |
virtual void | register_event (const std::string &sEventName) |
Enables reaction to an Event. | |
virtual void | unregister_event (const std::string &sEventName) |
Disables reaction to an Event. | |
Protected Attributes | |
event_manager * | pEventManager_ |
Abstract interface for event handling.
All classes which should react to some events should inherit from this class.
They will automatically react to Events thanks to the event_manager.
Definition at line 18 of file gui_eventreceiver.hpp.
gui::event_receiver::event_receiver | ( | event_manager * | mManager = nullptr |
) | [explicit] |
Constructor.
Definition at line 6 of file gui_eventreceiver.cpp.
gui::event_receiver::~event_receiver | ( | ) | [virtual] |
Destructor.
Definition at line 11 of file gui_eventreceiver.cpp.
virtual void gui::event_receiver::on_event | ( | const event & | mEvent | ) | [pure virtual] |
Called whenever an Event occurs.
mEvent | The Event which has occured |
Implemented in gui::button, gui::edit_box, gui::frame, gui::manager, and gui::slider.
void gui::event_receiver::register_event | ( | const std::string & | sEventName | ) | [virtual] |
Enables reaction to an Event.
sEventName | The name of the Event this class should react to |
Reimplemented in gui::frame.
Definition at line 17 of file gui_eventreceiver.cpp.
void gui::event_receiver::unregister_event | ( | const std::string & | sEventName | ) | [virtual] |
Disables reaction to an Event.
sEventName | The name of the Event this class shouldn't react to anymore |
Reimplemented in gui::frame.
Definition at line 23 of file gui_eventreceiver.cpp.
event_manager* gui::event_receiver::pEventManager_ [protected] |
Definition at line 49 of file gui_eventreceiver.hpp.