1.10 |
Signal class used for defining a signal and dispatching events. More...
#include <signal.h>
Public Types | |
enum | { INVALID_HANDLE = 0 } |
using | EventCallback = std::function< void(Args...)> |
Event handler callback function. | |
using | RegisterHandle = uint32_t |
Handle type. | |
Public Member Functions | |
void | clear () |
Clear all registered event handlers. | |
void | disable () |
Disable invoking callbacks. | |
void | enable () |
Enable invoking callbacks. | |
EGT_NODISCARD bool | enabled () const |
Is callback invoking enabled? | |
void | invoke (Args... args) |
Invoke all handlers with the specified args. | |
RegisterHandle | on_event (const EventCallback &handler) |
Add an event handler to be called when the widget generates an event. | |
RegisterHandle | operator() (const EventCallback &handler) |
Convenience wrapper for on_event(). | |
void | remove (RegisterHandle handle) |
Remove an event handler. | |
Signal class used for defining a signal and dispatching events.
using EventCallback = std::function<void(Args...)> |
Event handler callback function.
using RegisterHandle = uint32_t |
Handle type.
|
inline |
Clear all registered event handlers.
|
inline |
Disable invoking callbacks.
|
inline |
Enable invoking callbacks.
|
inline |
Is callback invoking enabled?
|
inline |
Invoke all handlers with the specified args.
args | Arguments for the handler. |
|
inline |
Add an event handler to be called when the widget generates an event.
Any number of handlers (callbacks) can be registered. Also, the same handler function can be registered multiple times, optionally with different masks.
handler | The callback to invoke on event. |
|
inline |
Convenience wrapper for on_event().
|
inline |
Remove an event handler.
handle | The handle returned from on_event(). |