class EE::UI::UIProperty::WeakHandle¶
Overview¶
Lifetime-safe, non-owning access used by containers such as UIBindingGroup. More…
#include <uiproperty.hpp> class WeakHandle { public: // methods std::optional<T> get() const; bool set(const T& value) const; Connection observe(Callback callback) const; ObservableValue<bool>::Connection observeLifetime(ObservableValue<bool>::Callback callback) const; ValidationConnection observeValidation(UIValueValidationState::Callback callback) const; UIValueValidationResult validation() const; UIWidget* validationEmitter() const; std::vector<UIWidget*> widgets() const; template <typename Container> void appendWidgets(Container& destination) const; template <typename WidgetCallback> void forEachWidget(WidgetCallback&& callback) const; UIWidget* firstEnabledWidget() const; operator bool() const; };
Detailed Documentation¶
Lifetime-safe, non-owning access used by containers such as UIBindingGroup.
Every operation becomes a harmless no-op or empty result after the UIProperty is destroyed. Like UIProperty itself, this handle is restricted to the widgets’ owning UI thread.
Methods¶
std::optional<T> get() const
Returns:
A copy of the value, or std::nullopt after expiration or binding reset.
bool set(const T& value) const
Returns:
true when the live property was assigned value.
Connection observe(Callback callback) const
Returns:
A scoped value observer connection, or an empty connection after expiration.
ObservableValue<bool>::Connection observeLifetime(ObservableValue<bool>::Callback callback) const
Returns:
A scoped connection notified when the property is about to expire.
ValidationConnection observeValidation(UIValueValidationState::Callback callback) const
Returns:
A scoped validation observer, or an empty connection after expiration.
UIValueValidationResult validation() const
Returns:
Current validation, or success after expiration.
UIWidget* validationEmitter() const
Returns:
The widget that produced the current input error, or nullptr.
std::vector<UIWidget*> widgets() const
Returns:
All currently connected widgets, or an empty vector after expiration.
template <typename Container> void appendWidgets(Container& destination) const
Appends connected widgets without creating an intermediate collection.
template <typename WidgetCallback> void forEachWidget(WidgetCallback&& callback) const
Invokes callback for every connected widget without allocating a collection.
UIWidget* firstEnabledWidget() const
Returns:
The first enabled connected widget, or nullptr.