Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- 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.
Constraint (ManagedPtr Constraint) |
Instances
Eq Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint (==) :: Constraint -> Constraint -> Bool # (/=) :: Constraint -> Constraint -> Bool # | |
GObject Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint | |
ManagedPtrNewtype Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint toManagedPtr :: Constraint -> ManagedPtr Constraint | |
TypedObject Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint | |
HasParentTypes Constraint Source # | |
Defined in GI.Gtk.Objects.Constraint | |
IsGValue (Maybe Constraint) Source # | Convert |
Defined in GI.Gtk.Objects.Constraint gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Constraint -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe 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
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isAttached, isConstant, isFloating, isRequired, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getConstant, getData, getMultiplier, getProperty, getQdata, getRelation, getSource, getSourceAttribute, getStrength, getTarget, getTargetAttribute.
Setters
getConstant
constraintGetConstant Source #
:: (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 #
:: (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 #
:: (HasCallStack, MonadIO m, IsConstraint a) | |
=> a |
|
-> m ConstraintRelation | Returns: a relation type |
The order relation between the terms of the constraint.
getSource
:: (HasCallStack, MonadIO m, IsConstraint a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsConstraint a) | |
=> a |
|
-> m ConstraintAttribute | Returns: the source's attribute |
Retrieves the attribute of the source to be read by the constraint.
getStrength
constraintGetStrength Source #
:: (HasCallStack, MonadIO m, IsConstraint a) | |
=> a |
|
-> m Int32 | Returns: the strength value |
Retrieves the strength of the constraint.
getTarget
:: (HasCallStack, MonadIO m, IsConstraint a) | |
=> a |
|
-> m (Maybe ConstraintTarget) | Returns: a |
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 #
:: (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
:: (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
:: (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
:: (HasCallStack, MonadIO m, IsConstraint a) | |
=> a |
|
-> m Bool | Returns: |
Checks whether the constraint is a required relation for solving the constraint layout.
new
:: (HasCallStack, MonadIO m, IsConstraintTarget a, IsConstraintTarget b) | |
=> Maybe a |
|
-> ConstraintAttribute |
|
-> ConstraintRelation |
|
-> Maybe b |
|
-> ConstraintAttribute |
|
-> Double |
|
-> Double |
|
-> Int32 |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsConstraintTarget a) | |
=> Maybe a |
|
-> ConstraintAttribute |
|
-> ConstraintRelation |
|
-> Double |
|
-> Int32 |
|
-> 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