Package ch.bailu.gtk.gobject
Klasse Binding
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.PropertyHolder
ch.bailu.gtk.gobject.Binding
- Alle implementierten Schnittstellen:
PointerInterface
`GObject` instance (or source) and another property on another `GObject`
instance (or target).
Whenever the source property changes, the same value is applied to the
target property; for instance, the following binding:
```c
g_object_bind_property (object1, "property-a",
object2, "property-b",
G_BINDING_DEFAULT);
```
will cause the property named "property-b" of @object2 to be updated
every time [method@GObject.set] or the specific accessor changes the value of
the property "property-a" of @object1.
It is possible to create a bidirectional binding between two properties
of two `GObject` instances, so that if either property changes, the
other is updated as well, for instance:
```c
g_object_bind_property (object1, "property-a",
object2, "property-b",
G_BINDING_BIDIRECTIONAL);
```
will keep the two properties in sync.
It is also possible to set a custom transformation function (in both
directions, in case of a bidirectional binding) to apply a custom
transformation from the source value to the target value before
applying it; for instance, the following binding:
```c
g_object_bind_property_full (adjustment1, "value",
adjustment2, "value",
G_BINDING_BIDIRECTIONAL,
celsius_to_fahrenheit,
fahrenheit_to_celsius,
NULL, NULL);
```
will keep the "value" property of the two adjustments in sync; the
@celsius_to_fahrenheit function will be called whenever the "value"
property of @adjustment1 changes and will transform the current value
of the property before applying it to the "value" property of @adjustment2.
Vice versa, the @fahrenheit_to_celsius function will be called whenever
the "value" property of @adjustment2 changes, and will transform the
current value of the property before applying it to the "value" property
of @adjustment1.
Note that #GBinding does not resolve cycles by itself; a cycle like
```
object1:propertyA -> object2:propertyB
object2:propertyB -> object3:propertyC
object3:propertyC -> object1:propertyA
```
might lead to an infinite loop. The loop, in this particular case,
can be avoided if the objects emit the `GObject::notify` signal only
if the value has effectively been changed. A binding is implemented
using the `GObject::notify` signal, so it is susceptible to all the
various ways of blocking a signal emission, like [func@GObject.signal_stop_emission]
or [func@GObject.signal_handler_block].
A binding will be severed, and the resources it allocates freed, whenever
either one of the `GObject` instances it refers to are finalized, or when
the #GBinding instance loses its last reference.
Bindings for languages with garbage collection can use
[method@GObject.Binding.unbind] to explicitly release a binding between the source
and target properties, instead of relying on the last reference on the
binding, source, and target instances to drop.
instance (or target).
Whenever the source property changes, the same value is applied to the
target property; for instance, the following binding:
```c
g_object_bind_property (object1, "property-a",
object2, "property-b",
G_BINDING_DEFAULT);
```
will cause the property named "property-b" of @object2 to be updated
every time [method@GObject.set] or the specific accessor changes the value of
the property "property-a" of @object1.
It is possible to create a bidirectional binding between two properties
of two `GObject` instances, so that if either property changes, the
other is updated as well, for instance:
```c
g_object_bind_property (object1, "property-a",
object2, "property-b",
G_BINDING_BIDIRECTIONAL);
```
will keep the two properties in sync.
It is also possible to set a custom transformation function (in both
directions, in case of a bidirectional binding) to apply a custom
transformation from the source value to the target value before
applying it; for instance, the following binding:
```c
g_object_bind_property_full (adjustment1, "value",
adjustment2, "value",
G_BINDING_BIDIRECTIONAL,
celsius_to_fahrenheit,
fahrenheit_to_celsius,
NULL, NULL);
```
will keep the "value" property of the two adjustments in sync; the
@celsius_to_fahrenheit function will be called whenever the "value"
property of @adjustment1 changes and will transform the current value
of the property before applying it to the "value" property of @adjustment2.
Vice versa, the @fahrenheit_to_celsius function will be called whenever
the "value" property of @adjustment2 changes, and will transform the
current value of the property before applying it to the "value" property
of @adjustment1.
Note that #GBinding does not resolve cycles by itself; a cycle like
```
object1:propertyA -> object2:propertyB
object2:propertyB -> object3:propertyC
object3:propertyC -> object1:propertyA
```
might lead to an infinite loop. The loop, in this particular case,
can be avoided if the objects emit the `GObject::notify` signal only
if the value has effectively been changed. A binding is implemented
using the `GObject::notify` signal, so it is susceptible to all the
various ways of blocking a signal emission, like [func@GObject.signal_stop_emission]
or [func@GObject.signal_handler_block].
A binding will be severed, and the resources it allocates freed, whenever
either one of the `GObject` instances it refers to are finalized, or when
the #GBinding instance loses its last reference.
Bindings for languages with garbage collection can use
[method@GObject.Binding.unbind] to explicitly release a binding between the source
and target properties, instead of relying on the last reference on the
binding, source, and target instances to drop.
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungRetrieves the #GObject instance used as the source of the binding.Retrieves the #GObject instance used as the target of the binding.static ClassHandler
int
getFlags()
Retrieves the flags passed when constructing the #GBinding.static int
static long
static TypeSystem.TypeSize
Veraltet.Retrieves the name of the property of #GBinding:source used as the source
of the binding.Veraltet.Retrieves the name of the property of #GBinding:target used as the target
of the binding.static long
static TypeSystem.TypeSize
void
unbind()
Explicitly releases the binding between the source and the target
property expressed by @binding.Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
Binding
-
-
Methodendetails
-
getClassHandler
-
dupSource
Retrieves the #GObject instance used as the source of the binding.
A #GBinding can outlive the source #GObject as the binding does not hold a
strong reference to the source. If the source is destroyed before the
binding then this function will return %NULL.- Gibt zurück:
- the source #GObject, or %NULL if the source does not exist any more.
-
dupTarget
Retrieves the #GObject instance used as the target of the binding.
A #GBinding can outlive the target #GObject as the binding does not hold a
strong reference to the target. If the target is destroyed before the
binding then this function will return %NULL.- Gibt zurück:
- the target #GObject, or %NULL if the target does not exist any more.
-
getFlags
public int getFlags()Retrieves the flags passed when constructing the #GBinding.- Gibt zurück:
- the #GBindingFlags used by the #GBinding
-
getSource
Veraltet.Retrieves the #GObject instance used as the source of the binding.
A #GBinding can outlive the source #GObject as the binding does not hold a
strong reference to the source. If the source is destroyed before the
binding then this function will return %NULL.
Use g_binding_dup_source() if the source or binding are used from different
threads as otherwise the pointer returned from this function might become
invalid if the source is finalized from another thread in the meantime.- Gibt zurück:
- the source #GObject, or %NULL if the source does not exist any more.
-
getSourceProperty
Retrieves the name of the property of #GBinding:source used as the source
of the binding.- Gibt zurück:
- the name of the source property
-
getTarget
Veraltet.Retrieves the #GObject instance used as the target of the binding.
A #GBinding can outlive the target #GObject as the binding does not hold a
strong reference to the target. If the target is destroyed before the
binding then this function will return %NULL.
Use g_binding_dup_target() if the target or binding are used from different
threads as otherwise the pointer returned from this function might become
invalid if the target is finalized from another thread in the meantime.- Gibt zurück:
- the target #GObject, or %NULL if the target does not exist any more.
-
getTargetProperty
Retrieves the name of the property of #GBinding:target used as the target
of the binding.- Gibt zurück:
- the name of the target property
-
unbind
public void unbind()Explicitly releases the binding between the source and the target
property expressed by @binding.
This function will release the reference that is being held on
the @binding instance if the binding is still bound; if you want to hold on
to the #GBinding instance after calling g_binding_unbind(), you will need
to hold a reference to it.
Note however that this function does not take ownership of @binding, it
only unrefs the reference that was initially created by
g_object_bind_property() and is owned by the binding. -
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-