Template helper for modules that process queued events for a widget.
More...
#include <spk_event_based_module.hpp>
|
| virtual void | _treatEvent (TEvent &p_ievent)=0 |
| | Handles a single event pulled from the queue.
|
template<typename TEvent>
class spk::Module::EventBasedModule< TEvent >
Template helper for modules that process queued events for a widget.
- Template Parameters
-
| TEvent | concrete event type; must be movable into the internal queue. |
- See also
- KeyboardModule, MouseModule, SystemModule
{
protected:
void _treatEvent(MyEvent &evt)
override { process(evt); }
};
MyModule module;
module.setWidget(root);
module.insertEvent(MyEvent{});
module.treatEvents();
Template helper for modules that process queued events for a widget.
Definition spk_event_based_module.hpp:30
virtual void _treatEvent(TEvent &p_ievent)=0
Handles a single event pulled from the queue.
◆ _treatEvent()
template<typename TEvent>
◆ hasEvent()
template<typename TEvent>
Checks whether the module has pending events.
- Returns
- true when at least one event is queued.
◆ insertEvent()
template<typename TEvent>
Queues a new event to be processed later.
- Parameters
-
| p_ievent | Event instance to enqueue. |
◆ setWidget()
template<typename TEvent>
Binds the module to a widget that will receive callbacks.
- Parameters
-
| p_widget | Target widget; may be null to detach. |
◆ widget()
template<typename TEvent>
Returns the currently bound widget.
- Returns
- Pointer to the widget or nullptr when detached.
The documentation for this class was generated from the following file: