Class WidgetBounds

java.lang.Object
com.valhalla.sdk.api.widgets.WidgetBounds

public final class WidgetBounds extends Object
Immutable native-surface rectangle for a widget whose geometry was published by the active adapter.

Geometry is optional evidence. An adapter may know a widget's identity, text, and actions without publishing safe bounds, so WidgetSnapshot.getBounds() returns an empty value in that case rather than a fabricated (0, 0, 0, 0) rectangle. Never treat absent geometry as a real position.

Containment is half-open: the left and top edges are inside, the right and bottom edges are outside, so adjacent rectangles never both contain a point.

  • Constructor Summary

    Constructors
    Constructor
    Description
    WidgetBounds(int x, int y, int width, int height)
    Creates validated native-surface bounds.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(int pointX, int pointY)
    Tests half-open containment of a native-surface point.
    boolean
    equals(Object other)
     
    int
    Returns the exclusive bottom edge.
    int
    Returns the height in native-surface pixels.
    int
    Returns the exclusive right edge.
    int
    Returns the width in native-surface pixels.
    int
    Returns the left coordinate.
    int
    Returns the top coordinate.
    int
     
     

    Methods inherited from class java.lang.Object

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

    • WidgetBounds

      public WidgetBounds(int x, int y, int width, int height)
      Creates validated native-surface bounds.
      Parameters:
      x - left coordinate on the native game surface
      y - top coordinate on the native game surface
      width - positive width in native-surface pixels
      height - positive height in native-surface pixels
      Throws:
      IllegalArgumentException - when width or height is not positive
  • Method Details

    • getX

      public int getX()
      Returns the left coordinate.
      Returns:
      the left coordinate
    • getY

      public int getY()
      Returns the top coordinate.
      Returns:
      the top coordinate
    • getWidth

      public int getWidth()
      Returns the width in native-surface pixels.
      Returns:
      the width in native-surface pixels
    • getHeight

      public int getHeight()
      Returns the height in native-surface pixels.
      Returns:
      the height in native-surface pixels
    • getRight

      public int getRight()
      Returns the exclusive right edge.
      Returns:
      the exclusive right edge
    • getBottom

      public int getBottom()
      Returns the exclusive bottom edge.
      Returns:
      the exclusive bottom edge
    • contains

      public boolean contains(int pointX, int pointY)
      Tests half-open containment of a native-surface point.
      Parameters:
      pointX - native-surface X coordinate
      pointY - native-surface Y coordinate
      Returns:
      true when the point lies inside these bounds
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object