1.10 |
Manages a single value. More...
#include <value.h>
Public Member Functions | |
Value (T value={}) noexcept | |
operator T () const | |
Get the current value. | |
Value< T > & | operator= (T value) |
Assign new value. | |
T | value () const |
Get the current value. | |
bool | value (T value) |
Set value. | |
Public Member Functions inherited from Object | |
Object () noexcept=default | |
Object (const Object &)=delete | |
Object (Object &&)=default | |
virtual | ~Object () noexcept=default |
void | clear_handlers () |
Clear all registered event handlers. | |
void | invoke_handlers (Event &event) |
Invoke all handlers with the specified event. | |
void | invoke_handlers (EventId event) |
Invoke all handlers with the specified EventId. | |
EGT_NODISCARD const std::string & | name () const |
Get the name of the Object. | |
void | name (const std::string &name) |
Set the name of the Object. | |
RegisterHandle | on_event (const EventCallback &handler, const FilterFlags &mask={}) |
Add an event handler to be called when the widget generates an event. | |
Object & | operator= (const Object &)=delete |
Object & | operator= (Object &&)=default |
void | remove_handler (RegisterHandle handle) |
Remove an event handler. | |
Public Attributes | |
Signal | on_value_changed |
Event signal. | |
Protected Attributes | |
T | m_value {} |
The current value. | |
Protected Attributes inherited from Object | |
detail::CopyOnWriteAllocate< CallbackArray > | m_callbacks |
Array of callbacks. | |
RegisterHandle | m_handle_counter {0} |
Counter used to generate unique handles for each callback registration. | |
std::string | m_name |
A user defined name for the Object. | |
Additional Inherited Members | |
Public Types inherited from Object | |
using | EventCallback = std::function< void(Event &event)> |
Event handler callback function. | |
using | FilterFlags = FlagsBase< EventId > |
Event handler EventId filter. | |
using | RegisterHandle = uint64_t |
Handle type. | |
Protected Types inherited from Object | |
using | CallbackArray = std::vector< CallbackMeta > |
Helper type for an array of callbacks. | |
Manages a single value.
|
inlineexplicitnoexcept |
[in] | value | Current value. |
|
inlineexplicit |
Get the current value.
|
inline |
Assign new value.
|
inline |
Get the current value.
|
inline |
|
protected |
The current value.