Class ClampLayout

All Implemented Interfaces:
PointerInterface

public class ClampLayout extends LayoutManager
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.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.ClampLayout.html

  • Constructor Details

    • ClampLayout

      public ClampLayout(PointerContainer pointer)
    • ClampLayout

      public ClampLayout()
      Creates a new `AdwClampLayout`.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getMaximumSize

      public int getMaximumSize()
      Gets the maximum size allocated to the children.
      Returns:
      the maximum size to allocate to the children
    • getTighteningThreshold

      public int getTighteningThreshold()
      Gets the size above which the children are clamped.
      Returns:
      the size above which the children are clamped
    • setMaximumSize

      public void setMaximumSize(int maximum_size)
      Sets the maximum size allocated to the children.

      It is the width if the layout is horizontal, or the height if it is vertical.
      Parameters:
      maximum_size - the maximum size
    • setTighteningThreshold

      public void setTighteningThreshold(int tightening_threshold)
      Sets the size above which the children are 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.
      Parameters:
      tightening_threshold - the tightening threshold
    • asOrientable

      public Orientable asOrientable()
      Implements interface Orientable. Call this to get access to interface functions.
      Returns:
      Orientable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()