1.10 |
Manages a value in a range. More...
#include <value.h>
Public Member Functions | |
RangeValue (T start, T end, T value={}) noexcept | |
EGT_NODISCARD T | end () const |
Get the end value. | |
void | end (T end) |
Set the end value. | |
operator T () const | |
Get the current value. | |
RangeValue< T > & | operator= (T value) |
Assign the current value. | |
EGT_NODISCARD T | start () const |
Get the start value. | |
void | start (T start) |
Set the start value. | |
EGT_NODISCARD 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_end {} |
The end value. | |
T | m_start {} |
The start value. | |
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 value in a range.
|
inlinenoexcept |
[in] | start | Start value for the range. |
[in] | end | End value in the range. |
[in] | value | Current value in the range. |
|
inline |
Get the end value.
|
inline |
Set the end value.
[in] | end | The end value. |
|
inlineexplicit |
Get the current value.
|
inline |
Assign the current value.
|
inline |
Get the start value.
|
inline |
Set the start value.
[in] | start | The start value. |
|
inline |
Get the current value.
|
inline |
Set value.
If the value is above end, the value will be set to end. If the value is below start, the value will be set to start.
[in] | value | Value to set. |
|
protected |
The end value.
|
protected |
The start value.
|
protected |
The current value.