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
GtkConstraint
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
constraint_ptr
Default implementationTyped pointer to the underlying
GtkConstraint
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkConstraint
instance.Declaration
Swift
var constraint_ptr: UnsafeMutablePointer<GtkConstraint>! { get }
-
Required Initialiser for types conforming to
ConstraintProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ConstraintPropertyName
source 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 : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a Constraint property
Declaration
Swift
@inlinable func get(property: ConstraintPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the 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
NULL
at 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
NULL
at 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
-
constant
Extension methodThe constant value to be added to the [property
Gtk.Constraint:source-attribute
].Declaration
Swift
@inlinable var constant: CDouble { get }
-
isAttached
Extension 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 }
-
isConstant
Extension 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 }
-
isRequired
Extension methodChecks whether the constraint is a required relation for solving the constraint layout.
Declaration
Swift
@inlinable var isRequired: Bool { get }
-
multiplier
Extension methodThe multiplication factor to be applied to the [property
Gtk.Constraint:source-attribute
].Declaration
Swift
@inlinable var multiplier: CDouble { get }
-
relation
Extension methodThe order relation between the terms of the constraint.
Declaration
Swift
@inlinable var relation: GtkConstraintRelation { get }
-
source
Extension 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 }
-
sourceAttribute
Extension methodRetrieves the attribute of the source to be read by the constraint.
Declaration
Swift
@inlinable var sourceAttribute: GtkConstraintAttribute { get }
-
strength
Extension 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 }
-
target
Extension 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 }
-
targetAttribute
Extension methodRetrieves the attribute of the target to be set by the constraint.
Declaration
Swift
@inlinable var targetAttribute: GtkConstraintAttribute { get }