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 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.
CSS nodes
AdwClamp
has a single CSS node with name clamp
.
Its children will receive the style classes .large
when the child reached
its maximum size, .small
when the clamp allocates its full size to the
child, .medium
in-between, or none if it hasn't computed its size yet.
Since: 1.0
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
- 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 ()
- 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 ()
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 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 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, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, 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, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBuildableId, getCanFocus, getCanTarget, getChild, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMaximumSize, getName, getNative, getNextSibling, getOpacity, getOrientation, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTighteningThreshold, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.
Setters
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, setValign, setVexpand, setVexpandSet, setVisible.
getChild
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the child widget of |
Gets the child widget of self
.
Since: 1.0
getMaximumSize
:: (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.
Since: 1.0
getTighteningThreshold
clampGetTighteningThreshold Source #
:: (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.
Since: 1.0
new
:: (HasCallStack, MonadIO m) | |
=> m Clamp | Returns: the newly created |
Creates a new AdwClamp
.
Since: 1.0
setChild
:: (HasCallStack, MonadIO m, IsClamp a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the child widget of self
.
Since: 1.0
setMaximumSize
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the maximum size allocated to the child.
Since: 1.0
setTighteningThreshold
clampSetTighteningThreshold Source #
:: (HasCallStack, MonadIO m, IsClamp a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the size above which the child is clamped.
Since: 1.0
Properties
child
The child widget of the AdwClamp
.
Since: 1.0
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.
Since: 1.0
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.
Since: 1.0
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 ]