Package limn.backend

Record Class SizeLimits

java.lang.Object
java.lang.Record
limn.backend.SizeLimits
Record Components:
minWidth - the narrowest the user may make the window, or 0
minHeight - the shortest, or 0
maxWidth - the widest, or 0
maxHeight - the tallest, or 0

public record SizeLimits(int minWidth, int minHeight, int maxWidth, int maxHeight) extends Record
The bounds a window's size is kept within while the user resizes it, in logical points. A bound of 0 is open: NONE lets the window be any size, and new SizeLimits(480, 360, 0, 0) only stops it shrinking below 480×360.

A negative bound is taken as open, as NativeWindow.setSizeLimits(int, int, int, int) has always taken it. A maximum below its minimum is refused: the desktop would have to break one of the two.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SizeLimits
    No bound on either axis.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SizeLimits(int minWidth, int minHeight, int maxWidth, int maxHeight)
    Creates an instance of a SizeLimits record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    clampHeight(float height)
     
    float
    clampWidth(float width)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the maxHeight record component.
    int
    Returns the value of the maxWidth record component.
    int
    Returns the value of the minHeight record component.
    int
    Returns the value of the minWidth record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NONE

      public static final SizeLimits NONE
      No bound on either axis.
  • Constructor Details

    • SizeLimits

      public SizeLimits(int minWidth, int minHeight, int maxWidth, int maxHeight)
      Creates an instance of a SizeLimits record class.
      Parameters:
      minWidth - the value for the minWidth record component
      minHeight - the value for the minHeight record component
      maxWidth - the value for the maxWidth record component
      maxHeight - the value for the maxHeight record component
  • Method Details

    • clampWidth

      public float clampWidth(float width)
      Parameters:
      width - a width in logical points
      Returns:
      it, brought within the width bounds
    • clampHeight

      public float clampHeight(float height)
      Parameters:
      height - a height in logical points
      Returns:
      it, brought within the height bounds
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • minWidth

      public int minWidth()
      Returns the value of the minWidth record component.
      Returns:
      the value of the minWidth record component
    • minHeight

      public int minHeight()
      Returns the value of the minHeight record component.
      Returns:
      the value of the minHeight record component
    • maxWidth

      public int maxWidth()
      Returns the value of the maxWidth record component.
      Returns:
      the value of the maxWidth record component
    • maxHeight

      public int maxHeight()
      Returns the value of the maxHeight record component.
      Returns:
      the value of the maxHeight record component