Package ch.bailu.gtk.gtk
Class Constraint
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gtk.Constraint
- All Implemented Interfaces:
PointerInterface
`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
[class@Gtk.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.
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
[class@Gtk.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.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionConstraint
(PointerContainer pointer) Constraint
(Pointer target, int target_attribute, int relation, Pointer source, int source_attribute, double multiplier, double constant, int strength) Creates a new constraint representing a relation between a layout
attribute on a source and a layout attribute on a target. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassHandler
double
Retrieves the constant factor added to the source attributes' value.static int
double
Retrieves the multiplication factor applied to the source
attribute's value.static long
static TypeSystem.TypeSize
int
The order relation between the terms of the constraint.Retrieves the [iface@Gtk.ConstraintTarget] used as the source for the
constraint.int
Retrieves the attribute of the source to be read by the constraint.int
Retrieves the strength of the constraint.Retrieves the [iface@Gtk.ConstraintTarget] used as the target for
the constraint.int
Retrieves the attribute of the target to be set by the constraint.static long
static TypeSystem.TypeSize
boolean
Checks whether the constraint is attached to a [class@Gtk.ConstraintLayout],
and it is contributing to the layout.boolean
Checks whether the constraint describes a relation between an attribute
on the [property@Gtk.Constraint:target] and a constant value.boolean
Checks whether the constraint is a required relation for solving the
constraint layout.static Constraint
newConstantConstraint
(Pointer target, int target_attribute, int relation, double constant, int strength) Creates a new constraint representing a relation between a layout
attribute on a target and a constant value.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
Constraint
-
Constraint
public Constraint(@Nullable Pointer target, int target_attribute, int relation, @Nullable Pointer source, int source_attribute, double multiplier, double constant, int strength) Creates a new constraint representing a relation between a layout
attribute on a source and a layout attribute on a target.- Parameters:
target
- the target of the constrainttarget_attribute
- the attribute of `target` to be setrelation
- the relation equivalence between `target_attribute` and `source_attribute`source
- the source of the constraintsource_attribute
- the attribute of `source` to be readmultiplier
- a multiplication factor to be applied to `source_attribute`constant
- a constant factor to be added to `source_attribute`strength
- the strength of the constraint
-
-
Method Details
-
getClassHandler
-
newConstantConstraint
public static Constraint newConstantConstraint(@Nullable Pointer target, int target_attribute, int relation, double constant, int strength) Creates a new constraint representing a relation between a layout
attribute on a target and a constant value.- Parameters:
target
- a the target of the constrainttarget_attribute
- the attribute of `target` to be setrelation
- the relation equivalence between `target_attribute` and `constant`constant
- a constant factor to be set on `target_attribute`strength
- the strength of the constraint- Returns:
- the newly created constraint
-
getConstant
public double getConstant()Retrieves the constant factor added to the source attributes' value.- Returns:
- a constant factor
-
getMultiplier
public double getMultiplier()Retrieves the multiplication factor applied to the source
attribute's value.- Returns:
- a multiplication factor
-
getRelation
public int getRelation()The order relation between the terms of the constraint.- Returns:
- a relation type
-
getSource
Retrieves 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 [class@Gtk.ConstraintLayout] as the source.- Returns:
- the source of the constraint
-
getSourceAttribute
public int getSourceAttribute()Retrieves the attribute of the source to be read by the constraint.- Returns:
- the source's attribute
-
getStrength
public int getStrength()Retrieves the strength of the constraint.- Returns:
- the strength value
-
getTarget
Retrieves 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 [class@Gtk.ConstraintLayout] as the target.- Returns:
- a `GtkConstraintTarget`
-
getTargetAttribute
public int getTargetAttribute()Retrieves the attribute of the target to be set by the constraint.- Returns:
- the target's attribute
-
isAttached
public boolean isAttached()Checks whether the constraint is attached to a [class@Gtk.ConstraintLayout],
and it is contributing to the layout.- Returns:
- `TRUE` if the constraint is attached
-
isConstant
public boolean isConstant()Checks whether the constraint describes a relation between an attribute
on the [property@Gtk.Constraint:target] and a constant value.- Returns:
- `TRUE` if the constraint is a constant relation
-
isRequired
public boolean isRequired()Checks whether the constraint is a required relation for solving the
constraint layout.- Returns:
- %TRUE if the constraint is required
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-