| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
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
- newtype Constraint = Constraint (ManagedPtr Constraint)
- class (GObject o, IsDescendantOf Constraint o) => IsConstraint o
- toConstraint :: (MonadIO m, IsConstraint o) => o -> m Constraint
- constraintGetConstant :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m Double
- constraintGetMultiplier :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m Double
- constraintGetRelation :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m ConstraintRelation
- constraintGetSource :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m (Maybe ConstraintTarget)
- constraintGetSourceAttribute :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m ConstraintAttribute
- constraintGetStrength :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m Int32
- constraintGetTarget :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m (Maybe ConstraintTarget)
- constraintGetTargetAttribute :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m ConstraintAttribute
- constraintIsAttached :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m Bool
- constraintIsConstant :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m Bool
- constraintIsRequired :: (HasCallStack, MonadIO m, IsConstraint a) => a -> m Bool
- constraintNew :: (HasCallStack, MonadIO m, IsConstraintTarget a, IsConstraintTarget b) => Maybe a -> ConstraintAttribute -> ConstraintRelation -> Maybe b -> ConstraintAttribute -> Double -> Double -> Int32 -> m Constraint
- constraintNewConstant :: (HasCallStack, MonadIO m, IsConstraintTarget a) => Maybe a -> ConstraintAttribute -> ConstraintRelation -> Double -> Int32 -> m Constraint
- constructConstraintConstant :: (IsConstraint o, MonadIO m) => Double -> m (GValueConstruct o)
- getConstraintConstant :: (MonadIO m, IsConstraint o) => o -> m Double
- constructConstraintMultiplier :: (IsConstraint o, MonadIO m) => Double -> m (GValueConstruct o)
- getConstraintMultiplier :: (MonadIO m, IsConstraint o) => o -> m Double
- constructConstraintRelation :: (IsConstraint o, MonadIO m) => ConstraintRelation -> m (GValueConstruct o)
- getConstraintRelation :: (MonadIO m, IsConstraint o) => o -> m ConstraintRelation
- constructConstraintSource :: (IsConstraint o, MonadIO m, IsConstraintTarget a) => a -> m (GValueConstruct o)
- getConstraintSource :: (MonadIO m, IsConstraint o) => o -> m (Maybe ConstraintTarget)
- constructConstraintSourceAttribute :: (IsConstraint o, MonadIO m) => ConstraintAttribute -> m (GValueConstruct o)
- getConstraintSourceAttribute :: (MonadIO m, IsConstraint o) => o -> m ConstraintAttribute
- constructConstraintStrength :: (IsConstraint o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getConstraintStrength :: (MonadIO m, IsConstraint o) => o -> m Int32
- constructConstraintTarget :: (IsConstraint o, MonadIO m, IsConstraintTarget a) => a -> m (GValueConstruct o)
- getConstraintTarget :: (MonadIO m, IsConstraint o) => o -> m (Maybe ConstraintTarget)
- constructConstraintTargetAttribute :: (IsConstraint o, MonadIO m) => ConstraintAttribute -> m (GValueConstruct o)
- getConstraintTargetAttribute :: (MonadIO m, IsConstraint o) => o -> m ConstraintAttribute
Exported types
newtype Constraint Source #
Memory-managed wrapper type.
Constructors
| Constraint (ManagedPtr Constraint) |
Instances
| Eq Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint | |
| GObject Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint | |
| ManagedPtrNewtype Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint Methods toManagedPtr :: Constraint -> ManagedPtr Constraint | |
| TypedObject Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint Methods glibType :: IO GType | |
| IsGValue Constraint Source # | Convert |
Defined in GI.Gtk.Objects.Constraint | |
| HasParentTypes Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint | |
| type ParentTypes Constraint Source # | |
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
| (GObject o, IsDescendantOf Constraint o) => IsConstraint o Source # | |
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 |
|
| -> 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 |
|
| -> 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 |
|
| -> m ConstraintRelation | Returns: a |
The order relation between the terms of the constraint.
getSource
Arguments
| :: (HasCallStack, MonadIO m, IsConstraint a) | |
| => a |
|
| -> m (Maybe ConstraintTarget) | Returns: a |
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 |
|
| -> 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 |
|
| -> m Int32 | Returns: the strength of the constraint |
Retrieves the strength of the constraint.
getTarget
Arguments
| :: (HasCallStack, MonadIO m, IsConstraint a) | |
| => a |
|
| -> m (Maybe ConstraintTarget) | Returns: a |
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 |
|
| -> m ConstraintAttribute | Returns: the target's attribute |
Retrieves the attribute of the target to be set by the constraint.
isAttached
Arguments
| :: (HasCallStack, MonadIO m, IsConstraint a) | |
| => a |
|
| -> m Bool | Returns: |
Checks whether the constraint is attached to a ConstraintLayout,
and it is contributing to the layout.
isConstant
Arguments
| :: (HasCallStack, MonadIO m, IsConstraint a) | |
| => a |
|
| -> m Bool | Returns: |
Checks whether the constraint describes a relation between an attribute
on the Constraint:target and a constant value.
isRequired
Arguments
| :: (HasCallStack, MonadIO m, IsConstraint a) | |
| => a |
|
| -> m Bool | Returns: |
Checks whether the constraint is a required relation for solving the
constraint layout.
new
Arguments
| :: (HasCallStack, MonadIO m, IsConstraintTarget a, IsConstraintTarget b) | |
| => Maybe a |
|
| -> ConstraintAttribute |
|
| -> ConstraintRelation |
|
| -> Maybe b |
|
| -> ConstraintAttribute |
|
| -> Double |
|
| -> Double |
|
| -> Int32 |
|
| -> m Constraint | Returns: the newly created |
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 |
|
| -> ConstraintAttribute |
|
| -> ConstraintRelation |
|
| -> Double |
|
| -> Int32 |
|
| -> m Constraint | Returns: the newly created |
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