Klasse Clamp

Alle implementierten Schnittstellen:
PointerInterface

public class Clamp extends Widget
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
[property@Clamp:unit] property to enable that behavior.

See also: [class@ClampLayout], [class@ClampScrollable].

## CSS nodes

`AdwClamp` has a single CSS node with name `clamp`.

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

  • Konstruktordetails

    • Clamp

      public Clamp(PointerContainer pointer)
    • Clamp

      public Clamp()
      Creates a new `AdwClamp`.
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getChild

      public Widget getChild()
      Gets the child widget of @self.
      Gibt zurück:
      the child widget of @self
    • getMaximumSize

      public int getMaximumSize()
      Gets the maximum size allocated to the child.
      Gibt zurück:
      the maximum size to allocate to the child
    • getTighteningThreshold

      public int getTighteningThreshold()
      Gets the size above which the child is clamped.
      Gibt zurück:
      the size above which the child is clamped
    • getUnit

      public int getUnit()
      Gets the length unit for maximum size and tightening threshold.
      Gibt zurück:
      the length unit
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the child widget of @self.
      Parameter:
      child - the child widget
    • setMaximumSize

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

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

      public void setTighteningThreshold(int tightening_threshold)
      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.
      Parameter:
      tightening_threshold - the tightening threshold
    • setUnit

      public void setUnit(int unit)
      Sets the length unit for maximum size and tightening threshold.

      Allows the sizes to vary depending on the text scale factor.
      Parameter:
      unit - the length unit
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Setzt außer Kraft:
      asAccessible in Klasse Widget
      Gibt zurück:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Setzt außer Kraft:
      asBuildable in Klasse Widget
      Gibt zurück:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Setzt außer Kraft:
      asConstraintTarget in Klasse Widget
      Gibt zurück:
      ConstraintTarget
    • asOrientable

      public Orientable asOrientable()
      Implements interface Orientable. Call this to get access to interface functions.
      Gibt zurück:
      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()