To Source bindings are one-way bindings that have an extra source to which to write the result value. More...
#include <kanzi/core.ui/binding/to_source_binding.hpp>
Static Public Member Functions | |
static ToSourceBindingSharedPtr | create (BindingSourcePtr readSource, BindingSourcePtr pushSource) |
Creates a To Source binding. | |
Protected Attributes | |
BindingSourcePtr | m_pushSource |
Push source. | |
Protected Attributes inherited from kanzi::AbstractBinding | |
bool | m_createdFromKZB |
Is the binding sourced from a KZB? This field is used to determine if the binding should be removed during patching. | |
BindingProcessorContainer | m_processors |
Binding processor (forward direction). | |
BindingSourcePtr | m_source |
Binding source. | |
Additional Inherited Members | |
Public Types inherited from kanzi::AbstractBinding | |
using | BindingProcessorConstIterator |
Binding processor iterator type. | |
using | BindingProcessorContainer |
Binding processor container type. | |
Public Member Functions inherited from kanzi::AbstractBinding | |
void | addProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor. | |
void | addReverseProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor (reverse direction). | |
BindingProcessorConstIterator | beginProcessors () const |
Gets an iterator to the beginning of binding processors. | |
BindingProcessorConstIterator | beginReverseProcessors () const |
Gets an iterator to the beginning of reverse direction binding processors. | |
AbstractBindingRuntimeSharedPtr | createRuntime (AbstractBindingSharedPtr binding, BindingLookupContextPtr sourceLookupContext, BindingTargetRuntimePtr targetRuntime) |
Creates a binding runtime for this binding. | |
BindingProcessorConstIterator | endProcessors () const |
Gets an iterator to the end of binding processors. | |
BindingProcessorConstIterator | endReverseProcessors () const |
Gets an iterator to the end of reverse direction binding processors. | |
BindingSource * | getSource () |
Gets the binding source for this binding. | |
bool | isCreatedFromKZB () const |
Indicates whether the binding is sourced from a KZB? Used to check whether or not to remove the binding during patching. | |
void | removeProcessor (BindingProcessor &processor) |
Remove a binding processor. | |
void | removeReverseProcessor (BindingProcessor &processor) |
Remove a binding processor (reverse direction). | |
void | setCreatedFromKZB (bool flag) |
Sets the created from KZB flag. | |
virtual | ~AbstractBinding ()=default |
Destructor. | |
To Source bindings are one-way bindings that have an extra source to which to write the result value.
To Source binding is the opposite of a regular one-way binding. To Source binding updates the source property whenever the target property changes.
The extra binding source, called push source, is used only for writing. To Source bindings have a binding target just like regular one-way bindings, but are usually set to Node or RenderPass objects with a DummyBindingTargetRuntime, so that they only write values to the push source.
The push source is usually a regular ObjectPropertyBindingSource. It does not install a value source or a property modifier, but instead writes the property value using setProperty().
To create a ToSourceBinding, create an extra binding source first:
Then create a ToSourceBinding using the push source created:
To add a ToSourceBinding to a Node or RenderPass, use a DummyBindingTargetRuntime:
You can specify a target property when calling setBinding for the ToSourceBinding. In this case, both values are written when the binding is executed.
Unlike with regular one-way bindings, which require the binding source and target to be connected to be considered connected, ToSourceBinding also requires the push source to be connected. Trying to update the binding manually when both sources or the target are not connected does nothing. However, DummyBindingTargetRuntime is considered always connected.
|
inlineexplicitprotected |
Constructor.
readSource | Regular, readable source. |
pushSource | Push source |
|
static |
Creates a To Source binding.
readSource | Regular, readable source. |
pushSource | Push source |
|
overrideprotectedvirtual |
AbstractBinding::createRuntime() implementation.
Implements kanzi::AbstractBinding.
|
protected |
Push source.
Used to create another binding source runtime to use as push source and write the binding result to. Regular binding target runtime is still also used.