template class EE::UI::UIReadOnlyValueBinding

Overview

Move-only one-way binding from a read-only observable to a widget property. More…

#include <uivaluebinding.hpp>

template <typename T>
class UIReadOnlyValueBinding {
public:
    // typedefs

    typedef UIValueConverter<T> Converter;

    // structs

    struct State;

    // construction

    UIReadOnlyValueBinding();
    UIReadOnlyValueBinding(const UIReadOnlyValueBinding&);
    UIReadOnlyValueBinding(UIReadOnlyValueBinding&&);

    template <typename Source>
    UIReadOnlyValueBinding(Source& source, UIWidget* widget, const Converter& converter = Converter::converterDefault(), const std::string& propertyName = "value");

    // methods

    UIReadOnlyValueBinding& operator=(const UIReadOnlyValueBinding&);
    UIReadOnlyValueBinding& operator=(UIReadOnlyValueBinding&&);
    void disconnect();
    operator bool() const;
    bool isValid() const;
    const UIValueValidationState* validationState() const;
};

Detailed Documentation

Move-only one-way binding from a read-only observable to a widget property.

Sources must provide ValueType, get(), observe(), and an ObservableValue-compatible Connection. The binding applies the current source value immediately and retains neither endpoint. Use this for ComputedValue outputs or whenever widget edits must not update the source.

Construction

template <typename Source>
UIReadOnlyValueBinding(Source& source, UIWidget* widget, const Converter& converter = Converter::converterDefault(), const std::string& propertyName = "value")

Starts one-way synchronization from source to a property of widget.

Methods

void disconnect()

Stops synchronization. Calling this repeatedly is safe.

operator bool() const

Returns:

Whether the source connection and widget endpoint remain active.

bool isValid() const

Returns:

Whether formatting the most recent source value succeeded.

const UIValueValidationState* validationState() const

Returns:

Formatting validation state, or nullptr for an empty binding.