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. More... | |
Protected Member Functions | |
AbstractBindingRuntimeSharedPtr | createRuntimeOverride (AbstractBindingSharedPtr binding, BindingLookupContextPtr sourceLookupContext, BindingTargetRuntimePtr bindingTarget) override |
AbstractBinding::createRuntime() implementation. More... | |
ToSourceBinding (BindingSourcePtr readSource, BindingSourcePtr pushSource) | |
Constructor. More... | |
Protected Member Functions inherited from kanzi::AbstractBinding | |
AbstractBinding (BindingSourcePtr source) | |
Constructor. More... | |
virtual void | addReverseProcessorOverride (BindingProcessorSharedPtr processor) |
Implementation-dependent binding processor add (reverse direction). More... | |
virtual BindingProcessorConstIterator | beginReverseProcessorsOverride () const |
Implementation-dependent access to reverse direction binding processors. More... | |
virtual BindingProcessorConstIterator | endReverseProcessorsOverride () const |
Implementation-dependent access to reverse direction binding processors. More... | |
virtual void | removeReverseProcessorOverride (BindingProcessor &processor) |
Implementation-dependent binding processor remove (reverse direction). More... | |
Protected Attributes | |
BindingSourcePtr | m_pushSource |
Push source. More... | |
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. More... | |
BindingProcessorContainer | m_processors |
Binding processor (forward direction). More... | |
BindingSourcePtr | m_source |
Binding source. More... | |
Additional Inherited Members | |
Public Types inherited from kanzi::AbstractBinding | |
typedef BindingProcessorContainer::const_iterator | BindingProcessorConstIterator |
Binding processor iterator type. More... | |
typedef vector< BindingProcessorSharedPtr > | BindingProcessorContainer |
Binding processor container type. More... | |
Public Member Functions inherited from kanzi::AbstractBinding | |
void | addProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor. More... | |
void | addReverseProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor (reverse direction). More... | |
BindingProcessorConstIterator | beginProcessors () const |
Gets an iterator to the beginning of binding processors. More... | |
BindingProcessorConstIterator | beginReverseProcessors () const |
Gets an iterator to the beginning of reverse direction binding processors. More... | |
AbstractBindingRuntimeSharedPtr | createRuntime (AbstractBindingSharedPtr binding, BindingLookupContextPtr sourceLookupContext, BindingTargetRuntimePtr targetRuntime) |
Creates a binding runtime for this binding. More... | |
BindingProcessorConstIterator | endProcessors () const |
Gets an iterator to the end of binding processors. More... | |
BindingProcessorConstIterator | endReverseProcessors () const |
Gets an iterator to the end of reverse direction binding processors. More... | |
BindingSource * | getSource () |
Gets the binding source for this binding. More... | |
bool | isCreatedFromKZB () const |
Indicates whether the binding is sourced from a KZB? Used to check whether or not to remove the binding during patching. More... | |
void | removeProcessor (BindingProcessor &processor) |
Remove a binding processor. More... | |
void | removeReverseProcessor (BindingProcessor &processor) |
Remove a binding processor (reverse direction). More... | |
void | setCreatedFromKZB (bool flag) |
Sets the created from KZB flag. More... | |
virtual | ~AbstractBinding ()=default |
Destructor. More... | |
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.