Binding

open class Binding(pointer: <Error class: unknown class><<Error class: unknown class>>) : Object, KGTyped

#GBinding is the representation of a binding between a property on a #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:

| 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 g_object_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:

| 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:

| 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

Since

2.26

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard

Properties

Link copied to clipboard

Flags to be used to control the #GBinding

Link copied to clipboard
val gobjectBindingPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val source: Object?

The #GObject that should be used as the source of the binding

Link copied to clipboard

The name of the property of #GBinding:source that should be used as the source of the binding.

Link copied to clipboard
open val target: Object?

The #GObject that should be used as the target of the binding

Link copied to clipboard

The name of the property of #GBinding:target that should be used as the target of the binding.

Functions

Link copied to clipboard
inline fun <T : KGTyped> Object.asType(): T

Convert object into type T.

Link copied to clipboard
open fun bindProperty(sourceProperty: String, target: Object, targetProperty: String, flags: BindingFlags): Binding

Creates a binding between @source_property on @source and @target_property on @target.

Link copied to clipboard
open fun bindPropertyFull(sourceProperty: String, target: Object, targetProperty: String, flags: BindingFlags, transformTo: Closure, transformFrom: Closure): Binding

Creates a binding between @source_property on @source and @target_property on @target, allowing you to set the transformation functions to be used by the binding.

Link copied to clipboard
fun connectNotify(connectFlags: ConnectFlags = ConnectFlags(0u), handler: (pspec: ParamSpec) -> Unit): <Error class: unknown class>

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Link copied to clipboard
open fun dupSource(): Object?

Retrieves the #GObject instance used as the source of the binding.

Link copied to clipboard
open fun dupTarget(): Object?

Retrieves the #GObject instance used as the target of the binding.

Link copied to clipboard
open fun forceFloating()

This function is intended for #GObject implementations to re-enforce a floating-ref object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

Link copied to clipboard
open fun freezeNotify()

Increases the freeze count on @object. If the freeze count is non-zero, the emission of "notify" signals on @object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

Link copied to clipboard
Link copied to clipboard

Retrieves the flags passed when constructing the #GBinding.

Link copied to clipboard
fun Object.getIntProperty(propertyName: String): Int
Link copied to clipboard
open fun getProperty(propertyName: String, value: Value)

Gets a property of an object.

Link copied to clipboard
open fun getSource(): Object?

Retrieves the #GObject instance used as the source of the binding.

Link copied to clipboard

Retrieves the name of the property of #GBinding:source used as the source of the binding.

Link copied to clipboard
fun Object.getStringProperty(propertyName: String): String?
Link copied to clipboard
open fun getTarget(): Object?

Retrieves the #GObject instance used as the target of the binding.

Link copied to clipboard

Retrieves the name of the property of #GBinding:target used as the target of the binding.

Link copied to clipboard
open fun isFloating(): Boolean

Checks whether @object has a floating-ref reference.

Link copied to clipboard
open fun notify(propertyName: String)

Emits a "notify" signal for the property @property_name on @object.

Link copied to clipboard
open fun notifyByPspec(pspec: ParamSpec)

Emits a "notify" signal for the property specified by @pspec on @object.

Link copied to clipboard
open fun ref(): Object

Increases the reference count of @object.

Link copied to clipboard
open fun refSink(): Object

Increase the reference count of @object, and possibly remove the floating-ref reference, if @object has a floating reference.

Link copied to clipboard
open fun runDispose()

Releases all references to other objects. This can be used to break reference cycles.

Link copied to clipboard
open fun setProperty(propertyName: String, value: Value)

Sets a property on an object.

Link copied to clipboard
fun Object.setProperty(propertyName: String, value: Boolean)
fun Object.setProperty(propertyName: String, value: Int)
fun Object.setProperty(propertyName: String, value: String?)
Link copied to clipboard
open fun thawNotify()

Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on @object and when it reaches zero, queued "notify" signals are emitted.

Link copied to clipboard
open fun unbind()

Explicitly releases the binding between the source and the target property expressed by @binding.

Link copied to clipboard
open fun unref()

Decreases the reference count of @object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

Link copied to clipboard
open fun watchClosure(closure: Closure)

This function essentially limits the life time of the @closure to the life time of the object. That is, when the object is finalized, the @closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the @closure, to ensure that an extra reference count is held on @object during invocation of the