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.

  • ptr

    Untyped pointer to the underlying GtkConstraint instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • constraint_ptr Default implementation

    Typed 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)

Constraint Class

  • 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 transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return 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:value:) Extension method

    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

Constraint Class: ConstraintProtocol extension (methods and fields)

  • getConstant() Extension method

    Retrieves the constant factor added to the source attributes’ value.

    Declaration

    Swift

    @inlinable
    func getConstant() -> CDouble
  • getMultiplier() Extension method

    Retrieves the multiplication factor applied to the source attribute’s value.

    Declaration

    Swift

    @inlinable
    func getMultiplier() -> CDouble
  • getRelation() Extension method

    The order relation between the terms of the constraint.

    Declaration

    Swift

    @inlinable
    func getRelation() -> GtkConstraintRelation
  • getSource() Extension method

    Retrieves the [ifaceGtk.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 method

    Retrieves the attribute of the source to be read by the constraint.

    Declaration

    Swift

    @inlinable
    func getSourceAttribute() -> GtkConstraintAttribute
  • getStrength() Extension method

    Retrieves the strength of the constraint.

    Declaration

    Swift

    @inlinable
    func getStrength() -> Int
  • getTarget() Extension method

    Retrieves the [ifaceGtk.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 method

    Retrieves the attribute of the target to be set by the constraint.

    Declaration

    Swift

    @inlinable
    func getTargetAttribute() -> GtkConstraintAttribute
  • constant Extension method

    The constant value to be added to the [propertyGtk.Constraint:source-attribute].

    Declaration

    Swift

    @inlinable
    var constant: CDouble { get }
  • isAttached Extension method

    Checks whether the constraint is attached to a [classGtk.ConstraintLayout], and it is contributing to the layout.

    Declaration

    Swift

    @inlinable
    var isAttached: Bool { get }
  • isConstant Extension method

    Checks whether the constraint describes a relation between an attribute on the [propertyGtk.Constraint:target] and a constant value.

    Declaration

    Swift

    @inlinable
    var isConstant: Bool { get }
  • isRequired Extension method

    Checks whether the constraint is a required relation for solving the constraint layout.

    Declaration

    Swift

    @inlinable
    var isRequired: Bool { get }
  • multiplier Extension method

    The multiplication factor to be applied to the [propertyGtk.Constraint:source-attribute].

    Declaration

    Swift

    @inlinable
    var multiplier: CDouble { get }
  • relation Extension method

    The order relation between the terms of the constraint.

    Declaration

    Swift

    @inlinable
    var relation: GtkConstraintRelation { get }
  • source Extension method

    The source of the constraint.

    The constraint will set the [propertyGtk.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 method

    Retrieves the attribute of the source to be read by the constraint.

    Declaration

    Swift

    @inlinable
    var sourceAttribute: GtkConstraintAttribute { get }
  • strength Extension method

    The strength of the constraint.

    The strength can be expressed either using one of the symbolic values of the [enumGtk.ConstraintStrength] enumeration, or any positive integer value.

    Declaration

    Swift

    @inlinable
    var strength: Int { get }
  • target Extension method

    The target of the constraint.

    The constraint will set the [propertyGtk.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 method

    Retrieves the attribute of the target to be set by the constraint.

    Declaration

    Swift

    @inlinable
    var targetAttribute: GtkConstraintAttribute { get }