gi-gtk-4.0.2: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.Constraint

Description

Constraint describes a constraint between an attribute on a widget and another attribute on another widget, expressed as a linear equation like:

 target.attr1 = source.attr2 × multiplier + constant

Each Constraint is part of a system that will be solved by a ConstraintLayout in order to allocate and position each child widget.

The source and target widgets, as well as their attributes, of a Constraint instance are immutable after creation.

Synopsis

Exported types

newtype Constraint Source #

Memory-managed wrapper type.

Instances

Instances details
Eq Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

IsGValue Constraint Source #

Convert Constraint to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.Constraint

ManagedPtrNewtype Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

TypedObject Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

Methods

glibType :: IO GType #

GObject Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

HasParentTypes Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

type ParentTypes Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

type ParentTypes Constraint = '[Object]

class (GObject o, IsDescendantOf Constraint o) => IsConstraint o Source #

Type class for types which can be safely cast to Constraint, for instance with toConstraint.

Instances

Instances details
(GObject o, IsDescendantOf Constraint o) => IsConstraint o Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

toConstraint :: (MonadIO m, IsConstraint o) => o -> m Constraint Source #

Cast to Constraint, for types for which this is known to be safe. For general casts, use castTo.

Methods

Overloaded methods

getConstant

constraintGetConstant Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m Double

Returns: a constant factor

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

getMultiplier

constraintGetMultiplier Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m Double

Returns: a multiplication factor

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

getRelation

constraintGetRelation Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m ConstraintRelation

Returns: a ConstraintRelation value

The order relation between the terms of the constraint.

getSource

constraintGetSource Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m (Maybe ConstraintTarget)

Returns: a ConstraintTarget

Retrieves the ConstraintTarget used as the source for constraint.

If the Constraint:source property is set to Nothing, the constraint will use the ConstraintLayout's widget.

getSourceAttribute

constraintGetSourceAttribute Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m ConstraintAttribute

Returns: the target's attribute

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

getStrength

constraintGetStrength Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m Int32

Returns: the strength of the constraint

Retrieves the strength of the constraint.

getTarget

constraintGetTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m (Maybe ConstraintTarget)

Returns: a ConstraintTarget

Retrieves the ConstraintTarget used as the target for constraint.

If the Constraint:target property is set to Nothing, the constraint will use the ConstraintLayout's widget.

getTargetAttribute

constraintGetTargetAttribute Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m ConstraintAttribute

Returns: the target's attribute

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

isAttached

constraintIsAttached Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m Bool

Returns: True if the constraint is attached

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

isConstant

constraintIsConstant Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m Bool

Returns: True if the constraint is a constant relation

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

isRequired

constraintIsRequired Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraint a) 
=> a

constraint: a Constraint

-> m Bool

Returns: True if the constraint is required

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

new

constraintNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraintTarget a, IsConstraintTarget b) 
=> Maybe a

target: a ConstraintTarget

-> ConstraintAttribute

targetAttribute: the attribute of target to be set

-> ConstraintRelation

relation: the relation equivalence between targetAttribute and sourceAttribute

-> Maybe b

source: a ConstraintTarget

-> ConstraintAttribute

sourceAttribute: the attribute of source to be read

-> Double

multiplier: a multiplication factor to be applied to sourceAttribute

-> Double

constant: a constant factor to be added to sourceAttribute

-> Int32

strength: the strength of the constraint

-> m Constraint

Returns: the newly created Constraint

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

newConstant

constraintNewConstant Source #

Arguments

:: (HasCallStack, MonadIO m, IsConstraintTarget a) 
=> Maybe a

target: a ConstraintTarget

-> ConstraintAttribute

targetAttribute: the attribute of target to be set

-> ConstraintRelation

relation: the relation equivalence between targetAttribute and constant

-> Double

constant: a constant factor to be set on targetAttribute

-> Int32

strength: the strength of the constraint

-> m Constraint

Returns: the newly created Constraint

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

Properties

constant

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

constructConstraintConstant :: (IsConstraint o, MonadIO m) => Double -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “constant” property. This is rarely needed directly, but it is used by new.

getConstraintConstant :: (MonadIO m, IsConstraint o) => o -> m Double Source #

Get the value of the “constant” property. When overloading is enabled, this is equivalent to

get constraint #constant

multiplier

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

constructConstraintMultiplier :: (IsConstraint o, MonadIO m) => Double -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “multiplier” property. This is rarely needed directly, but it is used by new.

getConstraintMultiplier :: (MonadIO m, IsConstraint o) => o -> m Double Source #

Get the value of the “multiplier” property. When overloading is enabled, this is equivalent to

get constraint #multiplier

relation

The order relation between the terms of the constraint.

constructConstraintRelation :: (IsConstraint o, MonadIO m) => ConstraintRelation -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “relation” property. This is rarely needed directly, but it is used by new.

getConstraintRelation :: (MonadIO m, IsConstraint o) => o -> m ConstraintRelation Source #

Get the value of the “relation” property. When overloading is enabled, this is equivalent to

get constraint #relation

source

The source of the constraint.

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

constructConstraintSource :: (IsConstraint o, MonadIO m, IsConstraintTarget a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “source” property. This is rarely needed directly, but it is used by new.

getConstraintSource :: (MonadIO m, IsConstraint o) => o -> m (Maybe ConstraintTarget) Source #

Get the value of the “source” property. When overloading is enabled, this is equivalent to

get constraint #source

sourceAttribute

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

constructConstraintSourceAttribute :: (IsConstraint o, MonadIO m) => ConstraintAttribute -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “source-attribute” property. This is rarely needed directly, but it is used by new.

getConstraintSourceAttribute :: (MonadIO m, IsConstraint o) => o -> m ConstraintAttribute Source #

Get the value of the “source-attribute” property. When overloading is enabled, this is equivalent to

get constraint #sourceAttribute

strength

The strength of the constraint.

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

constructConstraintStrength :: (IsConstraint o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “strength” property. This is rarely needed directly, but it is used by new.

getConstraintStrength :: (MonadIO m, IsConstraint o) => o -> m Int32 Source #

Get the value of the “strength” property. When overloading is enabled, this is equivalent to

get constraint #strength

target

The target of the constraint.

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

constructConstraintTarget :: (IsConstraint o, MonadIO m, IsConstraintTarget a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “target” property. This is rarely needed directly, but it is used by new.

getConstraintTarget :: (MonadIO m, IsConstraint o) => o -> m (Maybe ConstraintTarget) Source #

Get the value of the “target” property. When overloading is enabled, this is equivalent to

get constraint #target

targetAttribute

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

constructConstraintTargetAttribute :: (IsConstraint o, MonadIO m) => ConstraintAttribute -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “target-attribute” property. This is rarely needed directly, but it is used by new.

getConstraintTargetAttribute :: (MonadIO m, IsConstraint o) => o -> m ConstraintAttribute Source #

Get the value of the “target-attribute” property. When overloading is enabled, this is equivalent to

get constraint #targetAttribute