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>
|
|
| ~CheckBoxBinding () |
| | 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.
|
|
| CheckBoxBinding (CheckBoxBinding &&) 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.
|
| CheckBoxBinding & | operator= (CheckBoxBinding &&) 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.
|
|
| CheckBoxBinding (const CheckBoxBinding &)=delete |
|
CheckBoxBinding & | operator= (const CheckBoxBinding &)=delete |
| std::expected< void, TreeError > | sync () |
| | Read the latest committed model snapshot on UI between frames and synchronize presentation.
|
| std::expected< bool, TreeError > | value () const |
| std::expected< PropertyUpdate< bool >, TreeError > | set (bool value) |
|
|
std::expected< CheckBoxBinding, TreeError > | bindCheckbox (WidgetTree &, EventRouter &, Node< CheckBox >, std::unique_ptr< detail::CheckBoxEndpoint >, std::function< void(CheckBoxResult)>) |
| std::expected< CheckBoxBinding, TreeError > | bindCheckbox (WidgetTree &tree, EventRouter &router, Node< CheckBox > node, std::shared_ptr< Property< bool > > model, std::function< void(CheckBoxResult)> changed) |
| | Bind and initially synchronize a checkbox on UI outside a frame; the caller owns the returned token.
|
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.
◆ set()
- Parameters
-
| value | Authoritative replacement bool. |
- Returns
- Exact programmatic receipt; no user callback or automatic diagnostic.
◆ sync()
| std::expected< void, TreeError > portals::CheckBoxBinding::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.
◆ value()
| std::expected< bool, TreeError > portals::CheckBoxBinding::value |
( |
| ) |
const |
- Returns
- Authoritative bool value; checked-only, without reporting or callbacks.
◆ bindCheckbox
Bind and initially synchronize a checkbox on UI outside a frame; the caller owns the returned token.
- Parameters
-
| tree | Borrowed UI tree containing node and the model's invalidation target; outlives the binding/model. |
| router | Borrowed router for the same tree; tree, router and Scheduler outlive the binding. |
| node | Observing checkbox handle receiving presentation updates and routed activations. |
| model | Required shared owner of Property<bool>; retained by the binding's action and subscription. |
| changed | Required owning callback accepting CheckBoxResult by value. It receives the exact result of this gesture's set: unexpected means no commit, while a successful receipt can contain rejected or cancelled notifications. Receipt snapshots own their value and may be retained; callbacks may remove node/ancestors or destroy the binding. Observer deliveries never call changed. |
- Returns
- An owning CheckBoxBinding, or INVALID_ARGUMENT for a null model/callback or duplicate action; WRONG_THREAD, WRONG_SESSION, STALE_NODE, closed, WOULD_BLOCK (frame/nested dispatch), NO_MEMORY, NODE_LIMIT, CALLBACK_FAILED or another delegated Property/WidgetTree/EventRouter registration error.
- Exceptions
-
| std::bad_alloc | If construction of the by-value callback argument cannot allocate before API entry. Other exceptions from user capture construction before API entry also propagate. |
Gestures match Button. Toggle reads the latest model, commits once, updates presentation immediately even on rejected notifications, then transfers the exact receipt to changed. Invocation exceptions follow EventRouter's CALLBACK_FAILED contract; a committed model is never rolled back. Observer deliveries read the latest snapshot, so an old queued event cannot undo a toggle.
The documentation for this class was generated from the following file: