Class PaddedLayout

java.lang.Object
com.blackrook.gui.layout.PaddedLayout
All Implemented Interfaces:
GUILayout

public class PaddedLayout extends Object implements GUILayout
A layout for GUIObjects that resizes its children to its parent, with padded space around its edges, defined in screen units. If the units are a value less than one, it is treated as a percentage of the associated axis's width (or height).
Author:
Matthew Tropiano
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected float
    Padding on the bottom, in units.
    protected float
    Padding on the left, in units.
    protected float
    Padding on the right, in units.
    protected float
    Padding on the top, in units.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PaddedLayout(float units)
    Creates a new PaddedLayout with every edge having the same padding.
    PaddedLayout(float vertical, float horizontal)
    Creates a new PaddedLayout with the opposing edges having the same padding.
    PaddedLayout(float top, float horizontal, float bottom)
    Creates a new PaddedLayout with the opposing horzontal edges having the same padding and the vertical edges different.
    PaddedLayout(float top, float right, float bottom, float left)
    Creates a new PaddedLayout with every edge having the same padding.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    resizeChild(GUIObject object, int index, int childTotal)
    Called when a child object needs resizing.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • paddingTop

      protected float paddingTop
      Padding on the top, in units.
    • paddingRight

      protected float paddingRight
      Padding on the right, in units.
    • paddingBottom

      protected float paddingBottom
      Padding on the bottom, in units.
    • paddingLeft

      protected float paddingLeft
      Padding on the left, in units.
  • Constructor Details

    • PaddedLayout

      public PaddedLayout(float units)
      Creates a new PaddedLayout with every edge having the same padding.
      Parameters:
      units - the padding in units for all edges.
    • PaddedLayout

      public PaddedLayout(float vertical, float horizontal)
      Creates a new PaddedLayout with the opposing edges having the same padding.
      Parameters:
      vertical - the padding in units for the top and bottom.
      horizontal - the padding in units for the left and right.
    • PaddedLayout

      public PaddedLayout(float top, float horizontal, float bottom)
      Creates a new PaddedLayout with the opposing horzontal edges having the same padding and the vertical edges different.
      Parameters:
      top - the padding in units for the top.
      horizontal - the padding in units for the left and right.
      bottom - the padding in units for the bottom.
    • PaddedLayout

      public PaddedLayout(float top, float right, float bottom, float left)
      Creates a new PaddedLayout with every edge having the same padding.
      Parameters:
      top - the padding in units for the top.
      right - the padding in units for the right.
      bottom - the padding in units for the bottom.
      left - the padding in units for the left.
  • Method Details

    • resizeChild

      public void resizeChild(GUIObject object, int index, int childTotal)
      Description copied from interface: GUILayout
      Called when a child object needs resizing. DO NOT RESIZE THE PARENT OBJECT IN THIS METHOD, AS IT MAY CAUSE AN INFINITE LOOP TO OCCUR.
      Specified by:
      resizeChild in interface GUILayout
      Parameters:
      object - the object to resize.
      index - the child index while traversing through the list of children.
      childTotal - the total number of children.