Top |
Functions
Properties
double | constant | Read / Write / Construct Only |
double | multiplier | Read / Write / Construct Only |
GtkConstraintRelation | relation | Read / Write / Construct Only |
GtkConstraintTarget * | source | Read / Write / Construct Only |
GtkConstraintAttribute | source-attribute | Read / Write / Construct Only |
int | strength | Read / Write / Construct Only |
GtkConstraintTarget * | target | Read / Write / Construct Only |
GtkConstraintAttribute | target-attribute | Read / Write / Construct Only |
Known Implementations
GtkConstraintTarget is implemented by GtkAboutDialog, GtkActionBar, GtkAppChooserButton, GtkAppChooserDialog, GtkAppChooserWidget, GtkApplicationWindow, GtkAspectFrame, GtkAssistant, GtkBox, GtkButton, GtkCalendar, GtkCellView, GtkCenterBox, GtkCheckButton, GtkColorButton, GtkColorChooserDialog, GtkColorChooserWidget, GtkColumnView, GtkComboBox, GtkComboBoxText, GtkConstraintGuide, GtkDialog, GtkDragIcon, GtkDrawingArea, GtkDropDown, GtkEditableLabel, GtkEmojiChooser, GtkEntry, GtkExpander, GtkFileChooserDialog, GtkFileChooserWidget, GtkFixed, GtkFlowBox, GtkFlowBoxChild, GtkFontButton, GtkFontChooserDialog, GtkFontChooserWidget, GtkFrame, GtkGLArea, GtkGrid, GtkGridView, GtkHeaderBar, GtkIconView, GtkImage, GtkInfoBar, GtkLabel, GtkLevelBar, GtkLinkButton, GtkListBox, GtkListBoxRow, GtkListView, GtkLockButton, GtkMediaControls, GtkMenuButton, GtkMessageDialog, GtkNotebook, GtkOverlay, GtkPageSetupUnixDialog, GtkPaned, GtkPasswordEntry, GtkPicture, GtkPopover, GtkPopoverMenu, GtkPopoverMenuBar, GtkPrintUnixDialog, GtkProgressBar, GtkRange, GtkRevealer, GtkScale, GtkScaleButton, GtkScrollbar, GtkScrolledWindow, GtkSearchBar, GtkSearchEntry, GtkSeparator, GtkShortcutLabel, GtkShortcutsGroup, GtkShortcutsSection, GtkShortcutsShortcut, GtkShortcutsWindow, GtkSpinButton, GtkSpinner, GtkStack, GtkStackSidebar, GtkStackSwitcher, GtkStatusbar, GtkSwitch, GtkText, GtkTextView, GtkToggleButton, GtkTreeExpander, GtkTreeView, GtkVideo, GtkViewport, GtkVolumeButton, GtkWidget, GtkWindow, GtkWindowControls and GtkWindowHandle.
Description
GtkConstraint describes a constraint between an attribute on a widget and another attribute on another widget, expressed as a linear equation like:
1 |
target.attr1 = source.attr2 × 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.
The source and target widgets, as well as their attributes, of a GtkConstraint instance are immutable after creation.
Functions
gtk_constraint_new ()
GtkConstraint * gtk_constraint_new (gpointer target
,GtkConstraintAttribute target_attribute
,GtkConstraintRelation relation
,gpointer source
,GtkConstraintAttribute source_attribute
,double multiplier
,double constant
,int strength
);
Creates a new GtkConstraint representing a relation between a layout attribute on a source and a layout attribute on a target.
Parameters
target |
[nullable][type GtkConstraintTarget] | |
target_attribute |
the attribute of |
|
relation |
the relation equivalence between |
|
source |
[nullable][type GtkConstraintTarget] | |
source_attribute |
the attribute of |
|
multiplier |
a multiplication factor to be applied to |
|
constant |
a constant factor to be added to |
|
strength |
the strength of the constraint |
gtk_constraint_new_constant ()
GtkConstraint * gtk_constraint_new_constant (gpointer target
,GtkConstraintAttribute target_attribute
,GtkConstraintRelation relation
,double constant
,int strength
);
Creates a new GtkConstraint representing a relation between a layout attribute on a target and a constant value.
gtk_constraint_get_target ()
GtkConstraintTarget *
gtk_constraint_get_target (GtkConstraint *constraint
);
Retrieves the GtkConstraintTarget used as the target for constraint
.
If the “target” property is set to NULL
, the constraint
will use the GtkConstraintLayout's widget.
gtk_constraint_get_target_attribute ()
GtkConstraintAttribute
gtk_constraint_get_target_attribute (GtkConstraint *constraint
);
Retrieves the attribute of the target to be set by the constraint
.
gtk_constraint_get_relation ()
GtkConstraintRelation
gtk_constraint_get_relation (GtkConstraint *constraint
);
The order relation between the terms of the constraint
.
gtk_constraint_get_source ()
GtkConstraintTarget *
gtk_constraint_get_source (GtkConstraint *constraint
);
Retrieves the GtkConstraintTarget used as the source for constraint
.
If the “source” property is set to NULL
, the constraint
will use the GtkConstraintLayout's widget.
gtk_constraint_get_source_attribute ()
GtkConstraintAttribute
gtk_constraint_get_source_attribute (GtkConstraint *constraint
);
Retrieves the attribute of the source to be read by the constraint
.
gtk_constraint_get_multiplier ()
double
gtk_constraint_get_multiplier (GtkConstraint *constraint
);
Retrieves the multiplication factor applied to the source attribute's value.
gtk_constraint_get_constant ()
double
gtk_constraint_get_constant (GtkConstraint *constraint
);
Retrieves the constant factor added to the source attributes' value.
gtk_constraint_get_strength ()
int
gtk_constraint_get_strength (GtkConstraint *constraint
);
Retrieves the strength of the constraint.
gtk_constraint_is_required ()
gboolean
gtk_constraint_is_required (GtkConstraint *constraint
);
Checks whether the constraint
is a required relation for solving the
constraint layout.
gtk_constraint_is_attached ()
gboolean
gtk_constraint_is_attached (GtkConstraint *constraint
);
Checks whether the constraint
is attached to a GtkConstraintLayout,
and it is contributing to the layout.
gtk_constraint_is_constant ()
gboolean
gtk_constraint_is_constant (GtkConstraint *constraint
);
Checks whether the constraint
describes a relation between an attribute
on the “target” and a constant value.
Types and Values
GtkConstraint
typedef struct _GtkConstraint GtkConstraint;
An object describing the relation between two widget attributes.
All relations are in the form:
1 |
target.attr_name = source.attr_name × multiplier + constant |
A GtkConstraint is immutable once it's created.
GtkConstraintTarget
typedef struct _GtkConstraintTarget GtkConstraintTarget;
The GtkConstraintTarget interface is implemented by objects that can be used as source or target in GtkConstraints. Besides GtkWidget, it is also implemented by GtkConstraintGuide.
enum GtkConstraintAttribute
The widget attributes that can be used when creating a GtkConstraint.
Members
No attribute, used for constant relations |
||
The left edge of a widget, regardless of text direction |
||
The right edge of a widget, regardless of text direction |
||
The top edge of a widget |
||
The bottom edge of a widget |
||
The leading edge of a widget, depending
on text direction; equivalent to |
||
The trailing edge of a widget, depending
on text direction; equivalent to |
||
The width of a widget |
||
The height of a widget |
||
The center of a widget, on the horizontal axis |
||
The center of a widget, on the vertical axis |
||
The baseline of a widget |
enum GtkConstraintStrength
The strength of a constraint, expressed as a symbolic constant.
The strength of a GtkConstraint can be expressed with any positive integer; the values of this enumeration can be used for readability.
Property Details
The “constant”
property
“constant” double
The constant value to be added to the “source-attribute”.
Owner: GtkConstraint
Flags: Read / Write / Construct Only
Default value: 0
The “multiplier”
property
“multiplier” double
The multiplication factor to be applied to the “source-attribute”.
Owner: GtkConstraint
Flags: Read / Write / Construct Only
Default value: 1
The “relation”
property
“relation” GtkConstraintRelation
The order relation between the terms of the constraint.
Owner: GtkConstraint
Flags: Read / Write / Construct Only
Default value: GTK_CONSTRAINT_RELATION_EQ
The “source”
property
“source” GtkConstraintTarget *
The source of the constraint.
The constraint will set the “target-attribute” of the target using the “source-attribute” of the source.
Owner: GtkConstraint
Flags: Read / Write / Construct Only
The “source-attribute”
property
“source-attribute” GtkConstraintAttribute
The attribute of the “source” read by the constraint.
Owner: GtkConstraint
Flags: Read / Write / Construct Only
Default value: GTK_CONSTRAINT_ATTRIBUTE_NONE
The “strength”
property
“strength” int
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.
Owner: GtkConstraint
Flags: Read / Write / Construct Only
Allowed values: [0,1001001000]
Default value: 1001001000
The “target”
property
“target” GtkConstraintTarget *
The target of the constraint.
The constraint will set the “target-attribute” of the target using the “source-attribute” of the source widget.
Owner: GtkConstraint
Flags: Read / Write / Construct Only
The “target-attribute”
property
“target-attribute” GtkConstraintAttribute
The attribute of the “target” set by the constraint.
Owner: GtkConstraint
Flags: Read / Write / Construct Only
Default value: GTK_CONSTRAINT_ATTRIBUTE_NONE