|
xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
|
A handle for accessing a property. More...
#include <xentara/workbench/bindings/PropertyHandle.hpp>
Public Member Functions | |
| constexpr | PropertyHandle () noexcept=default |
| Default constructor that constructs a null handle that does not reference a property. | |
| constexpr | operator bool () const noexcept |
| Checks whether the handle references a property. | |
| template<PropertyChangedInvocable ChangeCallback> | |
| auto | subscribe (ChangeCallback &&changeCallback) const -> PropertyController::Subscription |
| Subscribes to the property. | |
| auto | subscribe (PropertyController::SubscriptionCallbacks callbacks) const -> PropertyController::Subscription |
| Subscribes to the property, with support for specialized callbacks. | |
| auto | publish (Action action=Action::ValueChanged, std::size_t index={}) const -> void |
| Publishes a value and state change for the property. | |
| auto | publishValue (Action action=Action::ValueChanged, std::size_t index={}) const -> void |
| Publishes a change to only the value of the property. | |
| auto | publishState () const -> void |
| Publishes a change in the state of the property. | |
| auto | publishVisibility () const -> void |
| Publishes a change in the visibility of the property. | |
| auto | state () const -> const utils::eh::expected< void, ui::String > & |
| Gets the state of the property. | |
| auto | visible () const -> bool |
| Gets the visibility of the property. | |
| constexpr auto | controller () const noexcept -> PropertyController & |
| Gets the controller. | |
| constexpr auto | property () const noexcept -> const PropertyId & |
| Gets the ID of the handled property. | |
A handle for accessing a property.
This object allows publishing and subscribing to a property without needing access to the controller.
|
constexprdefaultnoexcept |
Default constructor that constructs a null handle that does not reference a property.
|
constexprnoexcept |
Gets the controller.
|
explicitconstexprnoexcept |
Checks whether the handle references a property.
|
constexprnoexcept |
Gets the ID of the handled property.
| auto xentara::workbench::bindings::PropertyHandle::publish | ( | Action | action = Action::ValueChanged, |
| std::size_t | index = {} |
||
| ) | const -> void |
Publishes a value and state change for the property.
This function publishes both a value and a state change. To publish value and state changes separately, use publishValue() and publishState(), respectively. A visibility change is not published.
It is safe to call this function on a null handle. If the handle is null, the function will do nothing.
| action | The action that is being published |
| index | The index of the element that changed. This parameter is ignored if action is Action::ValueChanged. |
| auto xentara::workbench::bindings::PropertyHandle::publishState | ( | ) | const -> void |
Publishes a change in the state of the property.
| auto xentara::workbench::bindings::PropertyHandle::publishValue | ( | Action | action = Action::ValueChanged, |
| std::size_t | index = {} |
||
| ) | const -> void |
Publishes a change to only the value of the property.
| action | The action that is being published |
| index | The index of the element that changed. This parameter is ignored if action is Action::ValueChanged. |
| auto xentara::workbench::bindings::PropertyHandle::publishVisibility | ( | ) | const -> void |
Publishes a change in the visibility of the property.
It is safe to call this function on a null handle. If the handle is null, the function will do nothing.
| auto xentara::workbench::bindings::PropertyHandle::state | ( | ) | const -> const utils::eh::expected<void, ui::String> & |
Gets the state of the property.
The current state of the property. The state will be either a short localized text describing the error, or a default constructed expected if there is no error.
Invisible properties cannot have error states. If the property is invisible, this function will always return a default constructed expected.
| auto xentara::workbench::bindings::PropertyHandle::subscribe | ( | ChangeCallback && | changeCallback | ) | const -> PropertyController::Subscription |
Subscribes to the property.
It is safe to call this function on a null handle. If the handle is null, the function will return a null subscription.
| changeCallback | A callback that will be called whenever the property’s value has changed. |
| auto xentara::workbench::bindings::PropertyHandle::subscribe | ( | PropertyController::SubscriptionCallbacks | callbacks | ) | const -> PropertyController::Subscription |
Subscribes to the property, with support for specialized callbacks.
It is safe to call this function on a null handle. If the handle is null, the function will do nothing.
| callbacks | The callbacks. |
| auto xentara::workbench::bindings::PropertyHandle::visible | ( | ) | const -> bool |
Gets the visibility of the property.