1.37 <GtkConstraint>

Class: <GtkConstraint>

It derives from <GObject>.

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 <GtkConstraintLayout> 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.

Properties

Property: constraint:constant self

The constant value to be added to the constraint:source-attribute.

Its value is a real number.

It can only be set when the object is made, with #:constant.

Property: constraint:multiplier self

The multiplication factor to be applied to the constraint:source-attribute.

Its value is a real number.

It can only be set when the object is made, with #:multiplier.

Property: constraint:relation self

The order relation between the terms of the constraint.

Its value is a <GtkConstraintRelation> (or, to set it, one of its symbols).

It can only be set when the object is made, with #:relation.

Property: constraint:source self

The source of the constraint.

The constraint will set the constraint:target-attribute property of the target using the constraint:source-attribute property of the source.

Its value is a <GtkConstraintTarget>, or #f.

It can only be set when the object is made, with #:source.

Property: constraint:source-attribute self

The attribute of the constraint:source read by the constraint.

Its value is a <GtkConstraintAttribute> (or, to set it, one of its symbols).

It can only be set when the object is made, with #:source-attribute.

Property: constraint:strength self

The strength of the constraint.

The strength can be expressed either using one of the symbolic values of the <GtkConstraintStrength> enumeration, or any positive integer value.

Its value is a 32-bit integer.

It can only be set when the object is made, with #:strength.

Property: constraint:target self

The target of the constraint.

The constraint will set the constraint:target-attribute property of the target using the constraint:source-attribute property of the source widget.

Its value is a <GtkConstraintTarget>, or #f.

It can only be set when the object is made, with #:target.

Property: constraint:target-attribute self

The attribute of the constraint:target set by the constraint.

Its value is a <GtkConstraintAttribute> (or, to set it, one of its symbols).

It can only be set when the object is made, with #:target-attribute.

Procedures

Method: constraint:get-constant self ⇒ %return
Method: get-constant self ⇒ %return

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

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a real number.

a constant factor

Method: constraint:get-multiplier self ⇒ %return
Method: get-multiplier self ⇒ %return

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

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a real number.

a multiplication factor

Method: constraint:get-relation self ⇒ %return
Method: get-relation self ⇒ %return

The order relation between the terms of the constraint.

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a <GtkConstraintRelation>.

a relation type

Method: constraint:get-source self ⇒ %return
Method: get-source self ⇒ %return

Retrieves the <GtkConstraintTarget> used as the source for the constraint.

If the source is set to NULL at creation, the constraint will use the widget using the <GtkConstraintLayout> as the source.

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a <GtkConstraintTarget>, or #f.

the source of the constraint

Method: constraint:get-source-attribute self ⇒ %return
Method: get-source-attribute self ⇒ %return

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

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a <GtkConstraintAttribute>.

the source’s attribute

Method: constraint:get-strength self ⇒ %return
Method: get-strength self ⇒ %return

Retrieves the strength of the constraint.

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a 32-bit integer.

the strength value

Method: constraint:get-target self ⇒ %return
Method: get-target self ⇒ %return

Retrieves the <GtkConstraintTarget> used as the target for the constraint.

If the targe is set to NULL at creation, the constraint will use the widget using the <GtkConstraintLayout> as the target.

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a <GtkConstraintTarget>, or #f.

a <GtkConstraintTarget>

Method: constraint:get-target-attribute self ⇒ %return
Method: get-target-attribute self ⇒ %return

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

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a <GtkConstraintAttribute>.

the target’s attribute

Method: constraint:is-attached? self ⇒ %return
Method: is-attached? self ⇒ %return

Checks whether the constraint is attached to a <GtkConstraintLayout>, and it is contributing to the layout.

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a boolean.

TRUE if the constraint is attached

Method: constraint:is-constant? self ⇒ %return
Method: is-constant? self ⇒ %return

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

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a boolean.

TRUE if the constraint is a constant relation

Method: constraint:is-required? self ⇒ %return
Method: is-required? self ⇒ %return

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

self

Passed: a <GtkConstraint>.

a <GtkConstraint>

%return

Returned: a boolean.

#t if the constraint is required

Procedure: constraint:new target target-attribute relation source source-attribute multiplier constant strength ⇒ %return

Creates a new constraint representing a relation between a layout attribute on a source and a layout attribute on a target.

target

Passed: a <GtkConstraintTarget>, or #f.

the target of the constraint

target-attribute

Passed: a <GtkConstraintAttribute>, or one of its symbols.

the attribute of target to be set

relation

Passed: a <GtkConstraintRelation>, or one of its symbols.

the relation equivalence between target_attribute and source_attribute

source

Passed: a <GtkConstraintTarget>, or #f.

the source of the constraint

source-attribute

Passed: a <GtkConstraintAttribute>, or one of its symbols.

the attribute of source to be read

multiplier

Passed: a real number.

a multiplication factor to be applied to source_attribute

constant

Passed: a real number.

a constant factor to be added to source_attribute

strength

Passed: a 32-bit integer.

the strength of the constraint

%return

Returned: a <GtkConstraint>.

the newly created constraint

Procedure: constraint:new-constant target target-attribute relation constant strength ⇒ %return

Creates a new constraint representing a relation between a layout attribute on a target and a constant value.

target

Passed: a <GtkConstraintTarget>, or #f.

a the target of the constraint

target-attribute

Passed: a <GtkConstraintAttribute>, or one of its symbols.

the attribute of target to be set

relation

Passed: a <GtkConstraintRelation>, or one of its symbols.

the relation equivalence between target_attribute and constant

constant

Passed: a real number.

a constant factor to be set on target_attribute

strength

Passed: a 32-bit integer.

the strength of the constraint

%return

Returned: a <GtkConstraint>.

the newly created constraint