.. index:: pair: class; EE::UI::UIProperty::WeakHandle .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle: class EE::UI::UIProperty::WeakHandle ==================================== .. toctree:: :hidden: Overview ~~~~~~~~ Lifetime-safe, non-owning access used by containers such as :ref:`UIBindingGroup `. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class WeakHandle { public: // methods std::optional :ref:`get`() const; bool :ref:`set`(const T& value) const; :ref:`Connection` :ref:`observe`(:ref:`Callback` callback) const; :ref:`ObservableValue`:::ref:`Connection` :ref:`observeLifetime`(:ref:`ObservableValue`:::ref:`Callback` callback) const; :ref:`ValidationConnection` :ref:`observeValidation`(:ref:`UIValueValidationState::Callback` callback) const; :ref:`UIValueValidationResult` :ref:`validation`() const; :ref:`UIWidget`* :ref:`validationEmitter`() const; std::vector<:ref:`UIWidget`*> :ref:`widgets`() const; template void :ref:`appendWidgets`(:ref:`Container`& destination) const; template void :ref:`forEachWidget`(WidgetCallback&& callback) const; :ref:`UIWidget`* :ref:`firstEnabledWidget`() const; :target:`operator bool`() const; }; .. _details-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Lifetime-safe, non-owning access used by containers such as :ref:`UIBindingGroup `. Every operation becomes a harmless no-op or empty result after the :ref:`UIProperty ` is destroyed. Like :ref:`UIProperty ` itself, this handle is restricted to the widgets' owning :ref:`UI ` thread. Methods ------- .. index:: pair: function; get .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1a6773c929642c5a180d0a8613435626e4: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::optional get() const .. rubric:: Returns: A copy of the value, or std::nullopt after expiration or binding reset. .. index:: pair: function; set .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1ad5430dfed908af7dcfd45fade14e98b5: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool set(const T& value) const .. rubric:: Returns: true when the live property was assigned ``value``. .. index:: pair: function; observe .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1adcba8e59c867a6c61cabb249cca517fe: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Connection` observe(:ref:`Callback` callback) const .. rubric:: Returns: A scoped value observer connection, or an empty connection after expiration. .. index:: pair: function; observeLifetime .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1a2914c8d1a46d79de130c4b7a53b948eb: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ObservableValue`:::ref:`Connection` observeLifetime(:ref:`ObservableValue`:::ref:`Callback` callback) const .. rubric:: Returns: A scoped connection notified when the property is about to expire. .. index:: pair: function; observeValidation .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1aaee4f0ab7c50d99c4e8bc219ef6ad140: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ValidationConnection` observeValidation(:ref:`UIValueValidationState::Callback` callback) const .. rubric:: Returns: A scoped validation observer, or an empty connection after expiration. .. index:: pair: function; validation .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1a3426744432ff5d2d0ed6f474c4395be3: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`UIValueValidationResult` validation() const .. rubric:: Returns: Current validation, or success after expiration. .. index:: pair: function; validationEmitter .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1a900f7885e7e12a6ad429319e4ec8189c: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`UIWidget`* validationEmitter() const .. rubric:: Returns: The widget that produced the current input error, or nullptr. .. index:: pair: function; widgets .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1abb19baeada56beb79b2f0c3fe883cc5d: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`UIWidget`*> widgets() const .. rubric:: Returns: All currently connected widgets, or an empty vector after expiration. .. index:: pair: function; appendWidgets .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1ace3e7add749eadea1ff8dfd3d8ab25f7: .. ref-code-block:: cpp :class: doxyrest-title-code-block template void appendWidgets(:ref:`Container`& destination) const Appends connected widgets without creating an intermediate collection. .. index:: pair: function; forEachWidget .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1a924636c013288d500876acbf2e8790ea: .. ref-code-block:: cpp :class: doxyrest-title-code-block template void forEachWidget(WidgetCallback&& callback) const Invokes ``callback`` for every connected widget without allocating a collection. .. index:: pair: function; firstEnabledWidget .. _doxid-class_e_e_1_1_u_i_1_1_u_i_property_1_1_weak_handle_1a1c11e990552248863a74662321772bfd: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`UIWidget`* firstEnabledWidget() const .. rubric:: Returns: The first enabled connected widget, or nullptr.