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 |
A layout manager constraining its children to a given size.
<picture> <source srcset="clamp-wide-dark.png" media="(prefers-color-scheme: dark)"> <img src="clamp-wide.png" alt="clamp-wide"> </picture> <picture> <source srcset="clamp-narrow-dark.png" media="(prefers-color-scheme: dark)"> <img src="clamp-narrow.png" alt="clamp-narrow"> </picture>
AdwClampLayout
constraints the size of the widgets it contains to a given
maximum size. It will constrain the width if it is horizontal, or the height
if it is vertical. The expansion of the children from their minimum to their
maximum size is eased out for a smooth transition.
If a child requires more than the requested maximum size, it will be allocated the minimum size it can fit in instead.
Each child will get the style classes .large when it reached its maximum size, .small when it's allocated the full size, .medium in-between, or none if it hasn't been allocated yet.
Since: 1.0
Synopsis
- newtype ClampLayout = ClampLayout (ManagedPtr ClampLayout)
- class (GObject o, IsDescendantOf ClampLayout o) => IsClampLayout o
- toClampLayout :: (MonadIO m, IsClampLayout o) => o -> m ClampLayout
- clampLayoutGetMaximumSize :: (HasCallStack, MonadIO m, IsClampLayout a) => a -> m Int32
- clampLayoutGetTighteningThreshold :: (HasCallStack, MonadIO m, IsClampLayout a) => a -> m Int32
- clampLayoutNew :: (HasCallStack, MonadIO m) => m ClampLayout
- clampLayoutSetMaximumSize :: (HasCallStack, MonadIO m, IsClampLayout a) => a -> Int32 -> m ()
- clampLayoutSetTighteningThreshold :: (HasCallStack, MonadIO m, IsClampLayout a) => a -> Int32 -> m ()
- constructClampLayoutMaximumSize :: (IsClampLayout o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getClampLayoutMaximumSize :: (MonadIO m, IsClampLayout o) => o -> m Int32
- setClampLayoutMaximumSize :: (MonadIO m, IsClampLayout o) => o -> Int32 -> m ()
- constructClampLayoutTighteningThreshold :: (IsClampLayout o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getClampLayoutTighteningThreshold :: (MonadIO m, IsClampLayout o) => o -> m Int32
- setClampLayoutTighteningThreshold :: (MonadIO m, IsClampLayout o) => o -> Int32 -> m ()
Exported types
newtype ClampLayout Source #
Memory-managed wrapper type.
ClampLayout (ManagedPtr ClampLayout) |
Instances
Eq ClampLayout Source # | |
Defined in GI.Adw.Objects.ClampLayout (==) :: ClampLayout -> ClampLayout -> Bool # (/=) :: ClampLayout -> ClampLayout -> Bool # | |
GObject ClampLayout Source # | |
Defined in GI.Adw.Objects.ClampLayout | |
ManagedPtrNewtype ClampLayout Source # | |
Defined in GI.Adw.Objects.ClampLayout toManagedPtr :: ClampLayout -> ManagedPtr ClampLayout | |
TypedObject ClampLayout Source # | |
Defined in GI.Adw.Objects.ClampLayout | |
HasParentTypes ClampLayout Source # | |
Defined in GI.Adw.Objects.ClampLayout | |
IsGValue (Maybe ClampLayout) Source # | Convert |
Defined in GI.Adw.Objects.ClampLayout gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ClampLayout -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ClampLayout) | |
type ParentTypes ClampLayout Source # | |
Defined in GI.Adw.Objects.ClampLayout type ParentTypes ClampLayout = '[LayoutManager, Object, Orientable] |
class (GObject o, IsDescendantOf ClampLayout o) => IsClampLayout o Source #
Type class for types which can be safely cast to ClampLayout
, for instance with toClampLayout
.
Instances
(GObject o, IsDescendantOf ClampLayout o) => IsClampLayout o Source # | |
Defined in GI.Adw.Objects.ClampLayout |
toClampLayout :: (MonadIO m, IsClampLayout o) => o -> m ClampLayout Source #
Cast to ClampLayout
, 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
allocate, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, layoutChanged, measure, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getLayoutChild, getMaximumSize, getOrientation, getProperty, getQdata, getRequestMode, getTighteningThreshold, getWidget.
Setters
setData, setDataFull, setMaximumSize, setOrientation, setProperty, setTighteningThreshold.
getMaximumSize
clampLayoutGetMaximumSize Source #
:: (HasCallStack, MonadIO m, IsClampLayout a) | |
=> a |
|
-> m Int32 | Returns: the maximum size to allocate to the children |
Gets the maximum size allocated to the children.
Since: 1.0
getTighteningThreshold
clampLayoutGetTighteningThreshold Source #
:: (HasCallStack, MonadIO m, IsClampLayout a) | |
=> a |
|
-> m Int32 | Returns: the size above which the children are clamped |
Gets the size above which the children are clamped.
Since: 1.0
new
:: (HasCallStack, MonadIO m) | |
=> m ClampLayout | Returns: the newly created |
Creates a new AdwClampLayout
.
Since: 1.0
setMaximumSize
clampLayoutSetMaximumSize Source #
:: (HasCallStack, MonadIO m, IsClampLayout a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the maximum size allocated to the children.
Since: 1.0
setTighteningThreshold
clampLayoutSetTighteningThreshold Source #
:: (HasCallStack, MonadIO m, IsClampLayout a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the size above which the children are clamped.
Since: 1.0
Properties
maximumSize
The maximum size to allocate to the children.
It is the width if the layout is horizontal, or the height if it is vertical.
Since: 1.0
constructClampLayoutMaximumSize :: (IsClampLayout o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “maximum-size
” property. This is rarely needed directly, but it is used by new
.
getClampLayoutMaximumSize :: (MonadIO m, IsClampLayout o) => o -> m Int32 Source #
Get the value of the “maximum-size
” property.
When overloading is enabled, this is equivalent to
get
clampLayout #maximumSize
setClampLayoutMaximumSize :: (MonadIO m, IsClampLayout o) => o -> Int32 -> m () Source #
Set the value of the “maximum-size
” property.
When overloading is enabled, this is equivalent to
set
clampLayout [ #maximumSize:=
value ]
tighteningThreshold
The size above which the child is clamped.
Starting from this size, the layout will tighten its grip on the children, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum size, the children will be allocated all the available size.
If the threshold is greater than the maximum size to allocate to the children, they will be allocated the whole size up to the maximum. If the threshold is lower than the minimum size to allocate to the children, that size will be used as the tightening threshold.
Effectively, tightening the grip on a child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.
Since: 1.0
constructClampLayoutTighteningThreshold :: (IsClampLayout o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “tightening-threshold
” property. This is rarely needed directly, but it is used by new
.
getClampLayoutTighteningThreshold :: (MonadIO m, IsClampLayout o) => o -> m Int32 Source #
Get the value of the “tightening-threshold
” property.
When overloading is enabled, this is equivalent to
get
clampLayout #tighteningThreshold
setClampLayoutTighteningThreshold :: (MonadIO m, IsClampLayout o) => o -> Int32 -> m () Source #
Set the value of the “tightening-threshold
” property.
When overloading is enabled, this is equivalent to
set
clampLayout [ #tighteningThreshold:=
value ]