ConstraintProtocol
public protocol ConstraintProtocol : ObjectProtocol
GtkConstraint describes a constraint between attributes of two widgets,
expressed as a linear equation.
The typical equation for a constraint is:
target.target_attr = source.source_attr × multiplier + constant
Each GtkConstraint is part of a system that will be solved by a
[classGtk.ConstraintLayout] in order to allocate and position each
child widget or guide.
The source and target, as well as their attributes, of a GtkConstraint
instance are immutable after creation.
The ConstraintProtocol protocol exposes the methods and properties of an underlying GtkConstraint instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Constraint.
Alternatively, use ConstraintRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkConstraintinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
constraint_ptrDefault implementationTyped pointer to the underlying
GtkConstraintinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkConstraintinstance.Declaration
Swift
var constraint_ptr: UnsafeMutablePointer<GtkConstraint>! { get } -
Required Initialiser for types conforming to
ConstraintProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ConstraintPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ConstraintPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Constraint property
Declaration
Swift
@inlinable func get(property: ConstraintPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a Constraint property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ConstraintPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getConstant()Extension methodRetrieves the constant factor added to the source attributes’ value.
Declaration
Swift
@inlinable func getConstant() -> CDouble -
getMultiplier()Extension methodRetrieves the multiplication factor applied to the source attribute’s value.
Declaration
Swift
@inlinable func getMultiplier() -> CDouble -
getRelation()Extension methodThe order relation between the terms of the constraint.
Declaration
Swift
@inlinable func getRelation() -> GtkConstraintRelation -
getSource()Extension methodRetrieves the [iface
Gtk.ConstraintTarget] used as the source for the constraint.If the source is set to
NULLat creation, the constraint will use the widget using the [classGtk.ConstraintLayout] as the source.Declaration
Swift
@inlinable func getSource() -> ConstraintTargetRef! -
getSourceAttribute()Extension methodRetrieves the attribute of the source to be read by the constraint.
Declaration
Swift
@inlinable func getSourceAttribute() -> GtkConstraintAttribute -
getStrength()Extension methodRetrieves the strength of the constraint.
Declaration
Swift
@inlinable func getStrength() -> Int -
getTarget()Extension methodRetrieves the [iface
Gtk.ConstraintTarget] used as the target for the constraint.If the targe is set to
NULLat creation, the constraint will use the widget using the [classGtk.ConstraintLayout] as the target.Declaration
Swift
@inlinable func getTarget() -> ConstraintTargetRef! -
getTargetAttribute()Extension methodRetrieves the attribute of the target to be set by the constraint.
Declaration
Swift
@inlinable func getTargetAttribute() -> GtkConstraintAttribute -
constantExtension methodThe constant value to be added to the [property
Gtk.Constraint:source-attribute].Declaration
Swift
@inlinable var constant: CDouble { get } -
isAttachedExtension methodChecks whether the constraint is attached to a [class
Gtk.ConstraintLayout], and it is contributing to the layout.Declaration
Swift
@inlinable var isAttached: Bool { get } -
isConstantExtension methodChecks whether the constraint describes a relation between an attribute on the [property
Gtk.Constraint:target] and a constant value.Declaration
Swift
@inlinable var isConstant: Bool { get } -
isRequiredExtension methodChecks whether the constraint is a required relation for solving the constraint layout.
Declaration
Swift
@inlinable var isRequired: Bool { get } -
multiplierExtension methodThe multiplication factor to be applied to the [property
Gtk.Constraint:source-attribute].Declaration
Swift
@inlinable var multiplier: CDouble { get } -
relationExtension methodThe order relation between the terms of the constraint.
Declaration
Swift
@inlinable var relation: GtkConstraintRelation { get } -
sourceExtension methodThe source of the constraint.
The constraint will set the [property
Gtk.Constraint:target-attribute] property of the target using the [propertyGtk.Constraint:source-attribute] property of the source.Declaration
Swift
@inlinable var source: ConstraintTargetRef! { get } -
sourceAttributeExtension methodRetrieves the attribute of the source to be read by the constraint.
Declaration
Swift
@inlinable var sourceAttribute: GtkConstraintAttribute { get } -
strengthExtension methodThe strength of the constraint.
The strength can be expressed either using one of the symbolic values of the [enum
Gtk.ConstraintStrength] enumeration, or any positive integer value.Declaration
Swift
@inlinable var strength: Int { get } -
targetExtension methodThe target of the constraint.
The constraint will set the [property
Gtk.Constraint:target-attribute] property of the target using the [propertyGtk.Constraint:source-attribute] property of the source widget.Declaration
Swift
@inlinable var target: ConstraintTargetRef! { get } -
targetAttributeExtension methodRetrieves the attribute of the target to be set by the constraint.
Declaration
Swift
@inlinable var targetAttribute: GtkConstraintAttribute { get }
View on GitHub
Install in Dash
ConstraintProtocol Protocol Reference