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.
<group>Layout containers</group> <gtkada_demo>create_constraints.adb</gtkada_demo>
function Get_Constant
(Self : not null access Gtk_Constraint_Record) return Gdouble
Retrieves the constant factor added to the source attributes' value.
a constant factor
function Get_Multiplier
(Self : not null access Gtk_Constraint_Record) return Gdouble
Retrieves the multiplication factor applied to the source attribute's value.
a multiplication factor
function Get_Relation
(Self : not null access Gtk_Constraint_Record)
return Gtk.Enums.Gtk_Constraint_Relation
The order relation between the terms of the constraint.
a relation type
function Get_Source
(Self : not null access Gtk_Constraint_Record)
return Gtk.Constraint_Target.Gtk_Constraint_Target
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.
the source of the constraint
function Get_Source_Attribute
(Self : not null access Gtk_Constraint_Record)
return Gtk.Enums.Gtk_Constraint_Attribute
Retrieves the attribute of the source to be read by the constraint.
the source's attribute
function Get_Strength
(Self : not null access Gtk_Constraint_Record) return Glib.Gint
Retrieves the strength of the constraint.
the strength value
function Get_Target
(Self : not null access Gtk_Constraint_Record)
return Gtk.Constraint_Target.Gtk_Constraint_Target
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.
a GtkConstraintTarget
function Get_Target_Attribute
(Self : not null access Gtk_Constraint_Record)
return Gtk.Enums.Gtk_Constraint_Attribute
Retrieves the attribute of the target to be set by the constraint.
the target's attribute
function Get_Type return Glib.GType
type Gtk_Constraint is access all Gtk_Constraint_Record'Class;
function Gtk_Constraint_New
(Target : Gtk.Constraint_Target.Gtk_Constraint_Target;
Target_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Relation : Gtk.Enums.Gtk_Constraint_Relation;
Source : Gtk.Constraint_Target.Gtk_Constraint_Target;
Source_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Multiplier : Gdouble;
The_Constant : Gdouble;
Strength : Glib.Gint) return Gtk_Constraint
Creates a new constraint representing a relation between a layout attribute on a source and a layout attribute on a target.
the target of the constraint
the attribute of target to be set
the relation equivalence between target_attribute and source_attribute
the source of the constraint
the attribute of source to be read
a multiplication factor to be applied to source_attribute
a constant factor to be added to source_attribute
the strength of the constraint
function Gtk_Constraint_New_Constant
(Target : Gtk.Constraint_Target.Gtk_Constraint_Target;
Target_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Relation : Gtk.Enums.Gtk_Constraint_Relation;
The_Constant : Gdouble;
Strength : Glib.Gint) return Gtk_Constraint
Creates a new constraint representing a relation between a layout attribute on a target and a constant value.
a the target of the constraint
the attribute of target to be set
the relation equivalence between target_attribute and constant
a constant factor to be set on target_attribute
the strength of the constraint
type Gtk_Constraint_Record is new GObject_Record with null record;
procedure Gtk_New
(Self : out Gtk_Constraint;
Target : Gtk.Constraint_Target.Gtk_Constraint_Target;
Target_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Relation : Gtk.Enums.Gtk_Constraint_Relation;
Source : Gtk.Constraint_Target.Gtk_Constraint_Target;
Source_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Multiplier : Gdouble;
The_Constant : Gdouble;
Strength : Glib.Gint)
Creates a new constraint representing a relation between a layout attribute on a source and a layout attribute on a target. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the target of the constraint
the attribute of target to be set
the relation equivalence between target_attribute and source_attribute
the source of the constraint
the attribute of source to be read
a multiplication factor to be applied to source_attribute
a constant factor to be added to source_attribute
the strength of the constraint
procedure Gtk_New_Constant
(Self : out Gtk_Constraint;
Target : Gtk.Constraint_Target.Gtk_Constraint_Target;
Target_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Relation : Gtk.Enums.Gtk_Constraint_Relation;
The_Constant : Gdouble;
Strength : Glib.Gint)
Creates a new constraint representing a relation between a layout attribute on a target and a constant value. Initialize_Constant does nothing if the object was already created with another call to Initialize* or G_New.
a the target of the constraint
the attribute of target to be set
the relation equivalence between target_attribute and constant
a constant factor to be set on target_attribute
the strength of the constraint
procedure Initialize
(Self : not null access Gtk_Constraint_Record'Class;
Target : Gtk.Constraint_Target.Gtk_Constraint_Target;
Target_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Relation : Gtk.Enums.Gtk_Constraint_Relation;
Source : Gtk.Constraint_Target.Gtk_Constraint_Target;
Source_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Multiplier : Gdouble;
The_Constant : Gdouble;
Strength : Glib.Gint)
Creates a new constraint representing a relation between a layout attribute on a source and a layout attribute on a target. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the target of the constraint
the attribute of target to be set
the relation equivalence between target_attribute and source_attribute
the source of the constraint
the attribute of source to be read
a multiplication factor to be applied to source_attribute
a constant factor to be added to source_attribute
the strength of the constraint
procedure Initialize_Constant
(Self : not null access Gtk_Constraint_Record'Class;
Target : Gtk.Constraint_Target.Gtk_Constraint_Target;
Target_Attribute : Gtk.Enums.Gtk_Constraint_Attribute;
Relation : Gtk.Enums.Gtk_Constraint_Relation;
The_Constant : Gdouble;
Strength : Glib.Gint)
Creates a new constraint representing a relation between a layout attribute on a target and a constant value. Initialize_Constant does nothing if the object was already created with another call to Initialize* or G_New.
a the target of the constraint
the attribute of target to be set
the relation equivalence between target_attribute and constant
a constant factor to be set on target_attribute
the strength of the constraint
function Is_Attached
(Self : not null access Gtk_Constraint_Record) return Boolean
Checks whether the constraint is attached to a [classGtk.ConstraintLayout], and it is contributing to the layout.
TRUE if the constraint is attached
function Is_Constant
(Self : not null access Gtk_Constraint_Record) return Boolean
Checks whether the constraint describes a relation between an attribute on the [propertyGtk.Constraint:target] and a constant value.
TRUE if the constraint is a constant relation
function Is_Required
(Self : not null access Gtk_Constraint_Record) return Boolean
Checks whether the constraint is a required relation for solving the constraint layout.
True if the constraint is required
Multiplier_Property : constant Glib.Properties.Property_Double;
Type: Gdouble The multiplication factor to be applied to the [propertyGtk.Constraint:source-attribute].
Relation_Property : constant Gtk.Enums.Property_Gtk_Constraint_Relation;
The order relation between the terms of the constraint.
Source_Attribute_Property : constant Gtk.Enums.Property_Gtk_Constraint_Attribute;
The attribute of the [propertyGtk.Constraint:source] read by the constraint.
Source_Property : constant Glib.Properties.Property_Interface;
Type: Gtk.Constraint_Target.Gtk_Constraint_Target 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.
Strength_Property : constant Glib.Properties.Property_Int;
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.
Target_Attribute_Property : constant Gtk.Enums.Property_Gtk_Constraint_Attribute;
The attribute of the [propertyGtk.Constraint:target] set by the constraint.
Target_Property : constant Glib.Properties.Property_Interface;
Type: Gtk.Constraint_Target.Gtk_Constraint_Target 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.
The_Constant_Property : constant Glib.Properties.Property_Double;
Type: Gdouble The constant value to be added to the [propertyGtk.Constraint:source-attribute].