gi-gtk-4.0.8: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.Constraint

Description

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

Synopsis

Exported types

newtype Constraint Source #

Memory-managed wrapper type.

Constructors

Constraint (ManagedPtr Constraint) 

Instances

Instances details
Eq Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

GObject Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

ManagedPtrNewtype Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

Methods

toManagedPtr :: Constraint -> ManagedPtr Constraint

TypedObject Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

Methods

glibType :: IO GType

HasParentTypes Constraint Source # 
Instance details

Defined in GI.Gtk.Objects.Constraint

IsGValue (Maybe Constraint) Source #

Convert Constraint to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.Constraint

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Constraint -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe 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

getConstant

constraintGetConstant Source #

Arguments

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

constraint: a GtkConstraint

-> 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 GtkConstraint

-> 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 GtkConstraint

-> m ConstraintRelation

Returns: a relation type

The order relation between the terms of the constraint.

getSource

constraintGetSource Source #

Arguments

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

constraint: a GtkConstraint

-> m (Maybe ConstraintTarget)

Returns: the source of the constraint

Retrieves the 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 ConstraintLayout as the source.

getSourceAttribute

constraintGetSourceAttribute Source #

Arguments

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

constraint: a GtkConstraint

-> m ConstraintAttribute

Returns: the source'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 GtkConstraint

-> m Int32

Returns: the strength value

Retrieves the strength of the constraint.

getTarget

constraintGetTarget Source #

Arguments

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

constraint: a GtkConstraint

-> m (Maybe ConstraintTarget)

Returns: a GtkConstraintTarget

Retrieves the 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 ConstraintLayout as the target.

getTargetAttribute

constraintGetTargetAttribute Source #

Arguments

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

constraint: a GtkConstraint

-> 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 GtkConstraint

-> 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 GtkConstraint

-> 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 GtkConstraint

-> 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: the target of the constraint

-> ConstraintAttribute

targetAttribute: the attribute of target to be set

-> ConstraintRelation

relation: the relation equivalence between target_attribute and source_attribute

-> Maybe b

source: the source of the constraint

-> ConstraintAttribute

sourceAttribute: the attribute of source to be read

-> Double

multiplier: a multiplication factor to be applied to source_attribute

-> Double

constant: a constant factor to be added to source_attribute

-> 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 the target of the constraint

-> ConstraintAttribute

targetAttribute: the attribute of target to be set

-> ConstraintRelation

relation: the relation equivalence between target_attribute and constant

-> Double

constant: a constant factor to be set on target_attribute

-> 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:sourceAttribute.

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:sourceAttribute.

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:targetAttribute property of the target using the Constraint:sourceAttribute property 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:targetAttribute property of the target using the Constraint:sourceAttribute property 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