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 |
GI.Adw.Objects.Clamp
Description
A widget constraining its child 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>
The AdwClamp
widget constrains the size of the widget 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 child from its minimum to its
maximum size is eased out for a smooth transition.
If the child requires more than the requested maximum size, it will be allocated the minimum size it can fit in instead.
AdwClamp
can scale with the text scale factor, use the
[propertyclampLayout
:unit] property to enable that behavior.
CSS nodes
AdwClamp
has a single CSS node with name clamp
.
Synopsis
- newtype Clamp = Clamp (ManagedPtr Clamp)
- class (GObject o, IsDescendantOf Clamp o) => IsClamp o
- toClamp :: (MonadIO m, IsClamp o) => o -> m Clamp
- clampGetChild :: (HasCallStack, MonadIO m, IsClamp a) => a -> m (Maybe Widget)
- clampGetMaximumSize :: (HasCallStack, MonadIO m, IsClamp a) => a -> m Int32
- clampGetTighteningThreshold :: (HasCallStack, MonadIO m, IsClamp a) => a -> m Int32
- clampGetUnit :: (HasCallStack, MonadIO m, IsClamp a) => a -> m LengthUnit
- clampNew :: (HasCallStack, MonadIO m) => m Clamp
- clampSetChild :: (HasCallStack, MonadIO m, IsClamp a, IsWidget b) => a -> Maybe b -> m ()
- clampSetMaximumSize :: (HasCallStack, MonadIO m, IsClamp a) => a -> Int32 -> m ()
- clampSetTighteningThreshold :: (HasCallStack, MonadIO m, IsClamp a) => a -> Int32 -> m ()
- clampSetUnit :: (HasCallStack, MonadIO m, IsClamp a) => a -> LengthUnit -> m ()
- clearClampChild :: (MonadIO m, IsClamp o) => o -> m ()
- constructClampChild :: (IsClamp o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getClampChild :: (MonadIO m, IsClamp o) => o -> m (Maybe Widget)
- setClampChild :: (MonadIO m, IsClamp o, IsWidget a) => o -> a -> m ()
- constructClampMaximumSize :: (IsClamp o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getClampMaximumSize :: (MonadIO m, IsClamp o) => o -> m Int32
- setClampMaximumSize :: (MonadIO m, IsClamp o) => o -> Int32 -> m ()
- constructClampTighteningThreshold :: (IsClamp o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getClampTighteningThreshold :: (MonadIO m, IsClamp o) => o -> m Int32
- setClampTighteningThreshold :: (MonadIO m, IsClamp o) => o -> Int32 -> m ()
- constructClampUnit :: (IsClamp o, MonadIO m) => LengthUnit -> m (GValueConstruct o)
- getClampUnit :: (MonadIO m, IsClamp o) => o -> m LengthUnit
- setClampUnit :: (MonadIO m, IsClamp o) => o -> LengthUnit -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Clamp Source # | |
GObject Clamp Source # | |
Defined in GI.Adw.Objects.Clamp | |
ManagedPtrNewtype Clamp Source # | |
Defined in GI.Adw.Objects.Clamp Methods toManagedPtr :: Clamp -> ManagedPtr Clamp | |
TypedObject Clamp Source # | |
Defined in GI.Adw.Objects.Clamp | |
HasParentTypes Clamp Source # | |
Defined in GI.Adw.Objects.Clamp | |
IsGValue (Maybe Clamp) Source # | Convert |
Defined in GI.Adw.Objects.Clamp Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Clamp -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Clamp) | |
type ParentTypes Clamp Source # | |
Defined in GI.Adw.Objects.Clamp type ParentTypes Clamp = '[Widget, Object, Accessible, Buildable, ConstraintTarget, Orientable] |
class (GObject o, IsDescendantOf Clamp o) => IsClamp o Source #
Instances
(GObject o, IsDescendantOf Clamp o) => IsClamp o Source # | |
Defined in GI.Adw.Objects.Clamp |
Methods
Click to display all available methods, including inherited ones
Methods
actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChild, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMaximumSize, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOrientation, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTighteningThreshold, getTooltipMarkup, getTooltipText, getUnit, getValign, getVexpand, getVexpandSet, getVisible, getWidth.
Setters
setAccessibleParent, setCanFocus, setCanTarget, setChild, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMaximumSize, setName, setOpacity, setOrientation, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTighteningThreshold, setTooltipMarkup, setTooltipText, setUnit, setValign, setVexpand, setVexpandSet, setVisible.
getChild
Arguments
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the child widget of |
Gets the child widget of self
.
getMaximumSize
Arguments
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> m Int32 | Returns: the maximum size to allocate to the child |
Gets the maximum size allocated to the child.
getTighteningThreshold
clampGetTighteningThreshold Source #
Arguments
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> m Int32 | Returns: the size above which the child is clamped |
Gets the size above which the child is clamped.
getUnit
Arguments
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> m LengthUnit | Returns: the length unit |
Gets the length unit for maximum size and tightening threshold.
Since: 1.4
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Clamp | Returns: the newly created |
Creates a new AdwClamp
.
setChild
Arguments
:: (HasCallStack, MonadIO m, IsClamp a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the child widget of self
.
setMaximumSize
Arguments
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the maximum size allocated to the child.
It is the width if the clamp is horizontal, or the height if it is vertical.
setTighteningThreshold
clampSetTighteningThreshold Source #
Arguments
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the size above which the child is clamped.
Starting from this size, the clamp will tighten its grip on the child, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum size, the child will be allocated all the available size.
If the threshold is greater than the maximum size to allocate to the child, the child will be allocated all the size up to the maximum. If the threshold is lower than the minimum size to allocate to the child, that size will be used as the tightening threshold.
Effectively, tightening the grip on the child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.
setUnit
Arguments
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> LengthUnit |
|
-> m () |
Sets the length unit for maximum size and tightening threshold.
Allows the sizes to vary depending on the text scale factor.
Since: 1.4
Properties
child
The child widget of the AdwClamp
.
clearClampChild :: (MonadIO m, IsClamp o) => o -> m () Source #
Set the value of the “child
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#child
constructClampChild :: (IsClamp o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “child
” property. This is rarely needed directly, but it is used by new
.
getClampChild :: (MonadIO m, IsClamp o) => o -> m (Maybe Widget) Source #
Get the value of the “child
” property.
When overloading is enabled, this is equivalent to
get
clamp #child
setClampChild :: (MonadIO m, IsClamp o, IsWidget a) => o -> a -> m () Source #
Set the value of the “child
” property.
When overloading is enabled, this is equivalent to
set
clamp [ #child:=
value ]
maximumSize
The maximum size allocated to the child.
It is the width if the clamp is horizontal, or the height if it is vertical.
constructClampMaximumSize :: (IsClamp 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
.
getClampMaximumSize :: (MonadIO m, IsClamp o) => o -> m Int32 Source #
Get the value of the “maximum-size
” property.
When overloading is enabled, this is equivalent to
get
clamp #maximumSize
setClampMaximumSize :: (MonadIO m, IsClamp o) => o -> Int32 -> m () Source #
Set the value of the “maximum-size
” property.
When overloading is enabled, this is equivalent to
set
clamp [ #maximumSize:=
value ]
tighteningThreshold
The size above which the child is clamped.
Starting from this size, the clamp will tighten its grip on the child, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum size, the child will be allocated all the available size.
If the threshold is greater than the maximum size to allocate to the child, the child will be allocated all the size up to the maximum. If the threshold is lower than the minimum size to allocate to the child, that size will be used as the tightening threshold.
Effectively, tightening the grip on the child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.
constructClampTighteningThreshold :: (IsClamp 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
.
getClampTighteningThreshold :: (MonadIO m, IsClamp o) => o -> m Int32 Source #
Get the value of the “tightening-threshold
” property.
When overloading is enabled, this is equivalent to
get
clamp #tighteningThreshold
setClampTighteningThreshold :: (MonadIO m, IsClamp o) => o -> Int32 -> m () Source #
Set the value of the “tightening-threshold
” property.
When overloading is enabled, this is equivalent to
set
clamp [ #tighteningThreshold:=
value ]
unit
The length unit for maximum size and tightening threshold.
Allows the sizes to vary depending on the text scale factor.
Since: 1.4
constructClampUnit :: (IsClamp o, MonadIO m) => LengthUnit -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “unit
” property. This is rarely needed directly, but it is used by new
.
getClampUnit :: (MonadIO m, IsClamp o) => o -> m LengthUnit Source #
Get the value of the “unit
” property.
When overloading is enabled, this is equivalent to
get
clamp #unit
setClampUnit :: (MonadIO m, IsClamp o) => o -> LengthUnit -> m () Source #
Set the value of the “unit
” property.
When overloading is enabled, this is equivalent to
set
clamp [ #unit:=
value ]