Class ClampScrollable

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Orientable, Scrollable, Proxy

@Generated("org.javagi.JavaGI") public final class ClampScrollable extends Widget implements Accessible, Buildable, ConstraintTarget, Orientable, Scrollable

A scrollable Clamp.

AdwClampScrollable is a variant of Clamp that implements the Scrollable interface.

The primary use case for AdwClampScrollable is clamping ListView.

See also: ClampLayout.

  • Constructor Details

    • ClampScrollable

      public ClampScrollable(MemorySegment address)
      Create a ClampScrollable instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ClampScrollable

      public ClampScrollable()
      Create a new ClampScrollable.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ClampScrollable class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ClampScrollable asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • getChild

      public @Nullable Widget getChild()
      Gets the child widget of self.
      Returns:
      the child widget of this ClampScrollable
    • getMaximumSize

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

      public int getTighteningThreshold()
      Gets the size above which the child is clamped.
      Returns:
      the size above which the child is clamped
    • getUnit

      public LengthUnit getUnit()
      Gets the length unit for maximum size and tightening threshold.
      Returns:
      the length unit
      Since:
      1.4
    • setChild

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

      public void setMaximumSize(int maximumSize)

      Sets the maximum size allocated to the child.

      It is the width if the clamp is horizontal, or the height if it is vertical.

      Parameters:
      maximumSize - the maximum size
    • setTighteningThreshold

      public void setTighteningThreshold(int tighteningThreshold)

      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 width, 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 width 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.

      Parameters:
      tighteningThreshold - the tightening threshold
    • setUnit

      public void setUnit(LengthUnit unit)

      Sets the length unit for maximum size and tightening threshold.

      Allows the sizes to vary depending on the text scale factor.

      Parameters:
      unit - the length unit
      Since:
      1.4
    • builder

      public static ClampScrollable.Builder<? extends ClampScrollable.Builder> builder()
      A ClampScrollable.Builder object constructs a ClampScrollable with the specified properties. Use the various set...() methods to set properties, and finish construction with ClampScrollable.Builder.build().
      Returns:
      the builder object