Own one checkbox's action, subscription and shared UI model owner. Tree, router and scheduler must outlive this token; destroy/move on UI between frames, including from its callback. Model changes never invoke the business callback. Call sync before each frame after external changes/draining events: notifications can be rejected, and equal Property::set does not retry them. Latest committed value wins.
More...
#include <controls.hpp>
|
|
| ~CheckStateBinding () |
| | Disconnect subscription/action and release model ownership on UI. Admitted callbacks retain their captures; router collection may defer the final model release. Wrong-thread subscription destruction terminates rather than throwing.
|
|
| CheckStateBinding (CheckStateBinding &&) noexcept |
| | Transfer all ownership from the unnamed source binding argument on UI. The source becomes empty; its sync returns INVALID_ARGUMENT and destruction is harmless. No callbacks run during this nonthrowing transfer.
|
| CheckStateBinding & | operator= (CheckStateBinding &&) noexcept |
| | Replace ownership from the unnamed source binding argument on UI; self-move is a no-op. The source becomes empty. All replacement fields are installed before retiring old resources; deferred capture reclamation can reenter UI code. Neither binding owns its tree/router.
|
|
| CheckStateBinding (const CheckStateBinding &)=delete |
|
CheckStateBinding & | operator= (const CheckStateBinding &)=delete |
| std::expected< void, TreeError > | sync () |
| | Read the latest committed model snapshot on UI between frames and synchronize presentation.
|
Own one checkbox's action, subscription and shared UI model owner. Tree, router and scheduler must outlive this token; destroy/move on UI between frames, including from its callback. Model changes never invoke the business callback. Call sync before each frame after external changes/draining events: notifications can be rejected, and equal Property::set does not retry them. Latest committed value wins.
◆ operator=()
Replace ownership from the unnamed source binding argument on UI; self-move is a no-op. The source becomes empty. All replacement fields are installed before retiring old resources; deferred capture reclamation can reenter UI code. Neither binding owns its tree/router.
- Returns
- This binding by reference; callers must not use the result if reentrant cleanup destroyed its owner.
◆ sync()
| std::expected< void, TreeError > portals::CheckStateBinding::sync |
( |
| ) |
|
Read the latest committed model snapshot on UI between frames and synchronize presentation.
- Returns
- Success with paint invalidation only on a value change; INVALID_ARGUMENT for a moved-from token, WRONG_THREAD from the model/tree, or the tree's WRONG_SESSION, STALE_NODE, closed, WOULD_BLOCK (active frame), CALLBACK_FAILED or invalidation error. Rejected notifications do not prevent resynchronization.
- Note
- No business callback runs; old queued notifications cannot overwrite a newer committed value.
◆ bindCheckbox
Bind an explicit checkbox state on UI, preserving Property commit receipts.
- Parameters
-
| tree | Borrowed UI tree; outlives binding, model and router. |
| router | Borrowed router for tree; existing eligibility/admission rules apply. |
| node | Observing live checkbox identity. |
| model | Required shared UI model; invalid committed enum values are rejected by sync/input. |
| changed | Required owning activation callback; receives one exact receipt, even on failure. |
| options | Owning cycle policy; invalid policy returns INVALID_ARGUMENT. |
- Returns
- Scoped binding or existing TreeError registration/synchronization errors; INVALID_ARGUMENT for null model, empty callback or invalid enum values. No business callback on external updates.
- Note
- Tree/router/scheduler outlive the UI-affine token. Admitted callbacks survive self-removal. Call sync before frames to recover rejected notifications. Equal values never repaint or republish. Callback exceptions become CALLBACK_FAILED through routing and cannot undo a committed model value.
The documentation for this class was generated from the following file: